Fatal error: Unsupported operand types
cridenour - October 6, 2009 - 06:28
| Project: | Ubercart Price Quotes |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Description
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.

#1
Update: I can view all the products themselves no problem.
#2
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.
#3
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_errorsand/orhtml_errorsin my php.ini file.#4
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 :(
#5
same error here only when going to a product that is in a subcategory. does UC support nested product categories?
#6
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.
#7
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.
#8
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.
#9
PHP version 5.2.10 here. I get the error.
#10
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!
#11
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.
#12
Please see the backtrace.
http://sales.heliport.chrisridenour.com/catalog/lighting/perimeter-lights
#13
@Island
That would be quite surprising, seeing the code in question below.
<?php
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.
#14
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.
#15
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.
#16
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.
#17
I'm also getting this issue. Any word on a patch for this? Let me know if any more info is required. Thanks.
#18
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...
#19
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.
#20
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...
#21
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
#22
subscribe.
#23
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.
#24
Applying the patch listed here: http://drupal.org/node/492718 fixed it for me, using Ubercart 2.2
#25
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."