I am using Drupal 5.5 with PostgreSQL. I receiving the following error on the View Products screen.

    * warning: array_keys() [function.array-keys]: The first argument should be an array in /usr/local/apache2/htdocs/drupal/sites/all/modules/ubercart/uc_product/uc_product.module on line 1609.
    * warning: in_array() [function.in-array]: Wrong datatype for second argument in /usr/local/apache2/htdocs/drupal/sites/all/modules/ubercart/uc_product/uc_product.module on line 1609.
    * warning: array_keys() [function.array-keys]: The first argument should be an array in /usr/local/apache2/htdocs/drupal/sites/all/modules/ubercart/uc_product/uc_product.module on line 1610.
    * warning: array_shift() [function.array-shift]: The argument should be an array in /usr/local/apache2/htdocs/drupal/sites/all/modules/ubercart/uc_product/uc_product.module on line 1610.

Under Manage Attributes, the number of options shown does not match the number of options truly created and displayed within the options screen. For instance, the Manage Attributes screen shows 12 for "# of options" under the attribute "Size" but I only have 3 options associated to that attribute (Small, Medium, and Large).

Comments

appel’s picture

Subscribing.

appel’s picture

I can easily make the error go away by checking if the variable passed to array_keys is an array. I don't atm know if this breaks anything further on though, so beware. :)

Open 'modules\ubercart\uc_product\uc_product.module', go to line 1609 and change this:

  if (!in_array($default_vid, array_keys($options))) {
    $default_vid = array_shift(array_keys($options));
  }

into this:

  if (is_array($options))
  if (!in_array($default_vid, array_keys($options))) {
    $default_vid = array_shift(array_keys($options));
  }
Shawn Conn’s picture

Status: Active » Fixed

The problem I believe is from products not have vocabularies set up yet. This fix will work for now. Lyle has fixed this and should show up in the next release.

appel’s picture

I can confirm that I had not set up any vocabularies in my local site when these errors occurred. The 'catalog' module wasn't enabled either.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.