warning: Invalid argument supplied for foreach() in uc_stock.module on line 83 (uc beta5)

Project: 
Ubercart
Category: 
bug report
Priority: 
normal
Status: 
fixed

line 83:

$items[] = array(
      'path' => 'admin/store/settings/checkout',
      'title' => t('Checkout settings'),
      'callback' => 'uc_cart_checkout_settings_overview',
      'access' => user_access('administer store'),
      'description' => t('Configure the checkout settings.'),
    );

the error comes out when submitting an order

Re: warning: Invalid argument supplied for foreach() in uc_stock

Weird... there's no foreach() there, and the line has changed in the code since then. The only thing I can figure is the code is now in uc_stock_workflow.inc. I added a check for an array in the only applicable place I could find.

Re: warning: Invalid argument supplied for foreach() in uc_stock

Beta 6 now uses a workflow action to decrement stock. Still, there's a chance that if an order is submitted with an empty list that this bug could be encounter. I've committed a patch to bazaar that checks for an empty array before the foreach, so that should resolve the issue.