Fatal error: Unsupported operand types in /var/aegir/acquia-drupal-6.14/sites/all/modules/ubercart/uc_store/includes/uc_price.inc on line 91

So far, I can't trace this to a specific module. Because it's a php fatal error, devel can't backtrace it either (or if it can, I can't figure out how at 230am).

Line 91 is using += array() which I'm guessing is the issue but again, I can't seem to pin this on a specific module yet. It's a slow process to find the culprit, if there is one (other than Ubercart itself).

BTW: Had to turn on E_ALL just to find this error, was previously a white-screen of death.

Comments

cridenour’s picture

Update: I can view all the products themselves no problem.

splash112’s picture

What do you do when you get this problem? Try to view a product, open one, or what?

It tries to change? some variable to an array but it can't.

Island Usurper’s picture

You can add ddebug_backtrace() right before the += line to get the backtrace printed out right before the error happens. Somehow I managed to configure PHP itself to show a backtrace on errors, but I'm afraid I don't remember how I did that. It might be a particular version I got from WAMP. Edit: I went and looked, and it might be display_startup_errors and/or html_errors in my php.ini file.

cridenour’s picture

It is when I go to a sub-category page (it is nested under another category).

And ddebug_backtrace() doesn't work on a PHP fatal error :(

zcferres’s picture

same error here only when going to a product that is in a subcategory. does UC support nested product categories?

zcferres’s picture

I just noticed that when I add the product to a top level category that contains no children it works. When I add it to a subcategory it doesn't work. When I add it to a top level category that contains children it doesn't work (even if it is not inside the children). This seems to be a problem with taxonomy and catalog.

cridenour’s picture

Glad to know I'm not crazy.

I think this definitely stands as critical. Would love to get some feedback from others who attempt to recreate this error.

Thanks.

Island Usurper’s picture

I still can't duplicate this. I wonder if it might be because of a difference in PHP version. I haven't had any problems with 5.2.8, but I think 5.3 will work as well.

zcferres’s picture

PHP version 5.2.10 here. I get the error.

splash112’s picture

I'm not really sure if I am pointing in the right direction, but this seems interesting:

http://bugs.php.net/bug.php?id=49000

It's about 5.2.9 nad up in CLI interactive mode (php -a). Functions in an include that define a function which includes another file...

Found it here:
http://framework.zend.com/issues/browse/ZF-7107%3Bjsessionid=37BAF367BB2...

Same error and php versions seem to match the problem. Might try to downgrade PHP to 5.2.8 or upgrade 5.2.11 and see how it behaves then.

Problem might be variable_get which is in includes/bootstrap.inc.

Good luck!

Island Usurper’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

I've tried it with PHP 5.2.9-1 and I still can't get any errors to show up. I'm starting to think there must be some kind of custom code or something that's using uc_price() the wrong way. I think the thing to do is to try ddebug_backtrace() again, but comment out the lines with the += in them. Stuff will probably break, but not as badly as a fatal error, so you should be able to see the output.

Reduced the priority down to normal since I don't think this is a problem specifically with Ubercart itself. If we can find out what part is interacting badly, we can go from there.

cridenour’s picture

splash112’s picture

@Island
That would be quite surprising, seeing the code in question below.

function uc_price($price_info, $context, $options = array()) {
  global $user;
  $values = array();

// ......

  // Initialize the options and context.
  $options += array(
    'cache' => variable_get('uc_price_caching', TRUE),
  );

Can't really see any possibility why $options should not be an array. My best bet would be PHP bug and solved in the latest release of PHP.

cridenour’s picture

I upgraded to 5.11 and am still seeing this issue. Perhaps it is a Aegir issue? Acquia Drupal issue?

If I can't get Ubercart running on Ubuntu 8.10 with Aegir and Acquia running, that's a problem. Of course, we need to find out _why_ this is happening.

Thank you so much for your help so far.

Island Usurper’s picture

Project: Ubercart » Ubercart Price Quotes
Version: 6.x-2.0-rc7 » 6.x-1.0
Status: Postponed (maintainer needs more info) » Active

theme_uc_quotes_products()

That's from a contrib module (uc_quotes, not the uc_quote that is in Ubercart), so I don't know how it works. I bet it needs to be fixed to work with the price API somehow. That's kind of strange, because I thought we had changed uc_currency_format() to be a wrapper for uc_price(). Its function signature wasn't changed, though, so other modules should still be able to use it the same way.

cridenour’s picture

Thanks for looking into this. I didn't recognize the contrib module :)

Disabling the module fixed the issue and will look forward to its maintainer making the update.

alexmartin’s picture

I'm also getting this issue. Any word on a patch for this? Let me know if any more info is required. Thanks.

arpieb’s picture

Priority: Normal » Critical

I'm running D6.14 + UC 6.x-2.2 on PHP 5.2.9 under CentOS, also getting this error on anything hierachical in the product catalog. I've got a client who has to give on-demand quotes for his customers for some products due to limited run/supply costs, so really need to know if a fix is on the way or I have to find a workaround for this feature...

Due to the fact that it flat breaks the site with a WSOD for anything using a hierarchical product catalog, upping it to a "critical" bug...

jazzitup’s picture

Confirmed! I've just tried to uncheck "Display products in the catalog in a grid." from

/admin/store/settings/catalog/edit/grid

and when I clicked on "Save configuration" button - this fatal error appeared. Now I can't see my catalog content as stated in #6.

arpieb’s picture

Confirmed this going the other way - I enabled product grid display, and the grid showed up fine. Disabled it again, and get a WSOD when the product listing is being displayed. That narrows it down to something related to the product list vs. grid...

arpieb’s picture

StatusFileSize
new10.61 KB
new4.52 KB
new9.34 KB
new3.95 KB

Actually, if $options is passed in and is not an array, this would definitely break, which is the case. I managed to get a backtrace dumped to file before the page crashed, and found that a value of '1' was being passed in list mode, whereas an empty array was passed in grid mode. Appending an array to a number using the += operator will not work...

Also, interestingly enough, the args passed to uc_price() are totally different when the uc_quotes module is enabled vs disabled. I'm attaching all four dumps (grid and list with uc_quotes enabled, and without) - might help someone who is more familiar with the workings of uc_quotes than I am... All were generated from the same catalog page, which was from a hierarchical product catalog.

Also, as a side note - I know that UC2 made some significant API changes that have broken some other modules - any chance this might also be a victim...? After all, uc_quotes hasn't been updated since Feb 2009, and UC2 came out in Oct 2009.

-R

derp’s picture

subscribe.

cridenour’s picture

Oh, I'm sure this is a UC2 cause - but here at Drupal, we like to ignore legacy and just force the contributed modules to catch up :)

We may need to have someone take over this module given this issue. I've lived without this module, but it sure would be nice to have. I'll see about patching this if I get the chance over the next couple of weeks.

TwistedLincoln’s picture

Applying the patch listed here: http://drupal.org/node/492718 fixed it for me, using Ubercart 2.2

deensdale’s picture

I have "fixed" this issue by changing the line 91 (uc_price.inc)

$options += array(

to

$options[] = array(

This is a quick fix only. My bespoke code is passing an array to uc_price but I still had the similar problem as the posts above. I will need to revisit my own module to find the reason later, I just thought I'll share my "hack."

TallDavid’s picture

Patch mentioned in #24 above did not work for me. Subscribe.
Note to self: e3e

alfthecat’s picture

subscribing

paskainos’s picture

@TwistedLincoln: same here. Applying this patch fixed this error for me too.

rodmarasi’s picture

patch at #24 did solve the problem for me, too. this issue has been around for more than a year. hopefully the will be an upgrade for this module soon.

brisath’s picture

Subscribe

brisath’s picture

I'm still getting these errors on any catalog taxonomy items clicked. I really like the module, but is it going to be maintained?

brisath’s picture

Perhaps mine is a different issue? My error reads

Fatal error: Unsupported operand types in /home/mysite/public_html/sites/all/modules/ubercart/uc_store/includes/uc_price.inc on line 85

Line 85 is the last one listed below

  // Initialize the context.
  $context += array(
    'revision' => 'themed',
    'type' => 'amount',
  );