After adding product to cart, I got the error:
Fatal error: Unsupported operand types in commerce/modules/cart/commerce_cart.module on line 830
Reinstalling module, clearing cache, etc didn't help.
As I see in code, in this place there are string:
$data = $line_item_wrapper->commerce_unit_price->data->value() + array('components' => array());
If I do the debug, I see that $line_item_wrapper->commerce_unit_price have empty "data" array - krumo($line_item_wrapper->value())
:
commerce_unit_price (Array, 1 element)
und (Array, 1 element)
0 (Array, 3 elements)
amount (String, 3 characters ) 790
currency_code (String, 1 characters ) R
data (Boolean) FALSE
but if I do krumo($current_line_item_wrapper->value());
, the data array isn't empty:
commerce_unit_price (Array, 1 element)
und (Array, 1 element)
0 (Array, 3 elements)
amount (String, 3 characters ) 790
currency_code (String, 1 characters ) R
data (Array, 1 element)
components (Array, 1 element)
0 (Array, 3 elements)
name (String, 10 characters ) base_price
price (Array, 3 elements)
amount (String, 3 characters ) 790
currency_code (String, 1 characters ) R
data (Array, 1 element)
components (Array, 0 elements)
included (Boolean) TRUE
Installing module on fresh install works normally, I can't reproduce issue on it, but I need to keep my orders and other data in current site. Where I must search and how I can solve this problem?
Comment | File | Size | Author |
---|---|---|---|
#36 | error.JPG | 65.15 KB | Tapendra Singh |
Comments
Comment #1
Ralf Eisler CreditAttribution: Ralf Eisler commentedI have the same error message here trying to delete a product.
Comment #2
msamavi CreditAttribution: msamavi commentedI have the same problem when trying to edit any content type.
Comment #3
MurzI try to delete this product, create new product, but always got this error when adding product to cart.
Maybe because I have the custom currency:
But also I try to use only default currencies without my custom, this also don't solve the problem. What can I try more?
Comment #4
rszrama CreditAttribution: rszrama commentedShouldn't have anything to do with your currency code. The big question here is how you all ended up with a FALSE value for data. It should be getting initialized to an empty array. Do you have any other modules or custom Rules on here interacting with prices?
Comment #5
MurzI try to install Shipping and Stock modules, but at now I disable and uninstall it, so at now there are only standard commerce module enabled, with standard rules.
At now there are enabled modules:
Can you describe how I can debug the price data creating process? Or how can I reset all to default without removing products and orders?
In which file and function there are done generation process for this array? I can try to do the debug in it for find which operation adds false.
Comment #6
j_ten_man CreditAttribution: j_ten_man commentedSame issue here. A couple of things to note for me:
- I have 3 items in my cart. 2 of them were added before upgrading to the latest version of commerce.
- The 3rd item was added after.
- The 2 items that were added before work fine. In other words, the data array is there and no error is thrown.
- The 3rd item is the one throwing the error. Data value is null for me.
This leads me to believe that it's the adding to the cart that has caused the issue but I have no idea where to begin since I don't know how it used to work...
Comment #7
j_ten_man CreditAttribution: j_ten_man commentedAll of my items added after upgrade have field_data_commerce_unit_price.commerce_unit_price_data equal to Array. In other words, prior to upgrade, I was getting a serialized array. Now it is just the word Array, meaning that for some reason it's not getting serialized on save...
Comment #8
j_ten_man CreditAttribution: j_ten_man commentedAfter stepping through this for some time, the problem has something to do with the way Drupal is delaying the database transaction. What I found was that the query to be run was correct (it has the serialized array as expected to be written to the database). However, between the time it writes that value and unserializes the data, it is changing what is written to the database. Anyways, by commenting out line 168 on commerce_price.module I was able to fix the problem. While this is not the correct solution to the problem, it has fixed it for me to allow users to checkout again.
Comment #9
rszrama CreditAttribution: rszrama commentedHmm, yeah, thanks for the lead. I wonder if something has indeed changed in either Drupal itself or the execution of our insert / update hooks to screw up the order of serialization / unserialization. I can say with certainty that there are no issues on a vanilla install - i.e. Commerce by itself - so maybe there's an API change that other modules aren't taking into consideration or something. : ?
Comment #10
chrisjlee CreditAttribution: chrisjlee commented+1 having same issue this happens when just adding a product to the cart. I'm getting a fatal error:
A lookup on that page brings up where the failure exists if i comment the whole else statement (below) the issue doesn't occur anymore. I don't get a fatal error:
Finally, i narrowed it down to just 830. If i comment out this line:
<?php // $data = $line_item_wrapper->commerce_unit_price->data->value() + array('components' => array()); ?>
The fatal error stops occuring.
But i'm also getting this error before
But that's a different issue and is apparently solve-able via this issue: #1253114: Notice: unserialize() [function.unserialize]: Error at offset 0 of 5 bytes
Comment #11
chrisjlee CreditAttribution: chrisjlee commentedFinally, I did some var_dump'ing and revealed the following (hope it this helps i'm pretty unfamiliar with this process):
Comment #12
rszrama CreditAttribution: rszrama commentedOut of curiosity, does running with this patch solve this for you?
#1253114: Notice: unserialize() [function.unserialize]: Error at offset 0 of 5 bytes
You'd likely need to remove the items from the cart and try to produce the error again.
Comment #13
j_ten_man CreditAttribution: j_ten_man commented@rszrama That patch does not fix the issue. It's still saves "Array" into the database and not the serialized array.
What type of pricing rules do people have? My only other thought is that this might be causing it. I have two rules that add a tax to the product price. Maybe this is causing the issue?
Comment #14
chrisjlee CreditAttribution: chrisjlee commentedSorry i guess fatal cart error was fixed when i patched #1253114: Notice: unserialize() [function.unserialize]: Error at offset 0 of 5 bytes.
Comment #15
batigol CreditAttribution: batigol commentedSame here:
Fatal error: Unsupported operand types in \sites\all\modules\commerce\modules\cart\commerce_cart.module on line 830
After:
adding product to a cart (/cart),
trying to delete product,
trying to edit content type with the products display,
and when editing menu items (views path).
Comment #16
batigol CreditAttribution: batigol commentedPatch from http://drupal.org/node/1253114 does not fix this issue for me.
EDIT: I honestly don't know WTF is going on but after server restart everything seems to work fine... I DID update.php (no database upgrades) and clear cache after install commerce module but it wasn't enough then. Now everything is working like it should from the beginning.
EDIT2: Again I have this issue. There are probably some dependencies but I don't see any.
Store/Orders/Shopping [admin/commerce/orders] carts give me this error.
Comment #17
kelutrab11 CreditAttribution: kelutrab11 commentedFatal error: Unsupported operand types in commerce\modules\cart\commerce_cart.module on line 830
got it all the time after install commerce module (with shipping, stock, paypal modules). Actually this could be critical. Cause it makes commerce completely unusable/broken. Above patch don't fix the issue.Comment #18
henrix34 CreditAttribution: henrix34 commentedSame error here. After disable and enable commerce modules I can add products to the cart.
This is the only place I get this error now.
Comment #19
rszrama CreditAttribution: rszrama commentedHey guys, we can't really escalate this beyond major because there's no set way to reproduce it. In other words, it may just be a module conflict or edge case configuration that results in the error. I'll commit the patch referenced above soon, and I wonder if people trying the patch are not realizing that the patch does not include an update process. In other words, you may need to resave the products that have invalid price field data arrays so they are no longer throwing this error. If it then works, then the patch is what's needed, and we should try harder to get an update function in place for it.
That said, I still have not been able to reproduce this error. I see several people +1'ing this, but everyone seems to have a different way of getting to the error. Can someone please list all the steps you would take from installing with Commerce Kickstart on to produce the error? Without that, I can't really take this any further.
If you're having issues disabling / re-enabling Commerce, first I'd say not to do that, and then second I'd say there's another issue that discusses changes to prevent that from malfunctioning... but I may have already committed it to -dev. : P
Comment #20
Murzrszrama, I send you full access to my test site, files and database for debugging this issue and "how to reproduce", hope it helps find problem.
Comment #21
henrix34 CreditAttribution: henrix34 commentedI have updated my site to 7.12 and all modules the site is using to latest stable releases. Install commerce and it's needed modules + paypal, stock, shipping. After enabling it, run database update (no changes), run cron, clear cache, rebuild permissions, restart server, and set only the basic things like enable example shipping plugin, enable PayPal WPS, add simply VAT tax rate and add some basic products.
After all this I couldn't add an item to cart... After re-enabling commerce modules I was able to do it. But as I said:
I can't get to it cause
Fatal error: Unsupported operand types in commerce\modules\cart\commerce_cart.module on line 830
Re-saving nodes/product is not working.
I will check this on clean commerce kick-start install, however I have disable all my site modules besides commerce and still have this error. The next step will be to check it with commerce 1.1... As you can see there is nothing unordinary.
Comment #22
j_ten_man CreditAttribution: j_ten_man commentedAlso using the stock module here and getting this issue. Maybe it's the cause somehow...
Comment #23
MurzBecause too hard to find the way how to reproduce this issue on fresh install, I think that better is to provide for Commerce Developer ftp, mysql and site admin accesses on test site, they can debug this error on working site quicker that find an non-reporoducible on fresh install bug :)
Comment #24
henrix34 CreditAttribution: henrix34 commented@Murz I agree. Cause commerce is completely unusable now. I don't know whats going on but now I can't even display views with product and not getting this error... Wherever there is something to do with product I get this error. It is strange cause I could browse products before. I did absolutely nothing, not even one change... and now I can't browse my site... Magic :)
EDIT: /admin/structure/types/add is not working. I can't add content type - how can this be related with commerce ?
Comment #25
rszrama CreditAttribution: rszrama commentedAre you all using the Stock module then? If so, what versions?
Comment #26
Murzrszrama, I try both versions of Stock module - 7.x-1.0-rc1 and 7.x-2.x-dev, but try to disable and uninstall it, but this isn't help.
Comment #27
slavosek CreditAttribution: slavosek commentedSOMEONE solve this problem??
Comment #28
j_ten_man CreditAttribution: j_ten_man commentedUsing Stock 7.x-1.0-rc1
Comment #29
slavosek CreditAttribution: slavosek commentedThanks for the advice, this is the result : Fatal error: Unsupported operand types in /home/www/transylvania-nabytek.cz/subdomeny/www/sites/all/modules/commerce/modules/cart/commerce_cart.module on line 830
Notice: unserialize() [function.unserialize]: Error at offset 0 of 5 bytes ve funkci commerce_price_field_load() (řádek: 88 v souboru /home/www/transylvania-nabytek.cz/subdomeny/www/sites/all/modules/commerce/modules/price/commerce_price.module).
Comment #30
rszrama CreditAttribution: rszrama commented@slavosek - It can't be solved until it can be reproduced from scratch. It looks like Stock may be the issue... are you using the Stock module? If so, have you tried the patch linked above to solve the problem?
Comment #31
Murz@rszrama, I have disable and uninstall Stock and Shipping modules on site http://test2.caramba-nn.ru/ to which I send you access, did you receive passwords via mail?
This is test site special for you, you can reproduce this error on page http://test2.caramba-nn.ru/node/33 after clicking "Add to cart", also you can debug, upgrade, reinstall, and broke anything in it :)
I want help to debug this issue, but don't know how, please tell me how I can help.
Issue is reproducible in my site on rendering Cart block after I add product to it (as anonymous user too). If I hide Cart block, it reproducible on Cart page.
Also I try patch from #1253114: Notice: unserialize() [function.unserialize]: Error at offset 0 of 5 bytes but it isn't solve the problem.
I don't know how to reproduce it on fresh install, so better is to do some breakpoints, print_r, look on database and do other debug things in working site with reproducible error instead of trying to find the way for reproduce it.
If we found the source of the problem, will be easier to reproduce it on fresh site.
Comment #32
no2e CreditAttribution: no2e commentedI got this error after deleting an order in
/admin/commerce/orders/carts
.Now I can't visit
/admin/commerce/orders/carts
again: it's a white screen with this error message.Have no Stock installed.
("fixed" it by deleting all orders from the database)
---
Btw, related (same?) issue:
#1433438: Filefield Pathss 7.x-1.0-beta3 and Drupal Commerce (/edit: ah, already marked as duplicate)
Comment #33
rszrama CreditAttribution: rszrama commentedYou got the same error message on the Shopping Carts View? This is indeed exceeding strange... there's nothing special about that. What other modules do you have enabled if not stock?
Comment #34
no2e CreditAttribution: no2e commentedAfter I deleted a shopping card order, yes. Doesn't happen again, now. If it will, I'll open an issue or update this here. I patched Commerce Price (because of other error messages), if it matters.
Comment #35
cancel.allow CreditAttribution: cancel.allow commentedI got same error after adding item to shopping cart. Can't access to pages with shopping cart block and to shopping cart page at all. After removing shopping cart block pages become accessible except shopping cart page.
Very strange error because i've already tested order with flat rate shipping and everything worked just fine. After this testing was installed filefield path module, but didn't configured it. Uninstalling module didnt solve an error.
System Commerce Kickstart 1.3 core (Modules: Views, Commerce, Commerce Multicurrency, Commerce AutoSKU, Shipping + Flat Rate, Physical Fields (dev), Imagecache Actions, i18n, EVA, Views Slideshow).
Comment #36
Tapendra Singh CreditAttribution: Tapendra Singh commentedI am also facing same error while developing the site. I have tried by enabling and disabling the commerce module. Cleared so many times cache of my drupal site. I have also upgraded all the modules of commerce and tried to resolve this error but I did not get success. I have also removed the products existing one and created new one's but I faced same error on site.I have attached the jpeg of error which i am facing right now. Is there anyone having solution to resolve this ?.
Comment #37
MurzThe problem is that line_item created on "add to cart" process added without data object.
Seems that this issue is related to Filefield Paths module, because if I disable it on my site, the problem is disappear.
For disappearing the problem you must disable Filefield Paths module, clear cookies (for remove link to current cart content), after that error message must be go away. And if you try to add product to cart again, all goes to work normally.
Other followers, please check if you have Filefield Paths module enabled, try described method and report here.
Comment #38
j_ten_man CreditAttribution: j_ten_man commentedAlso using Filefield paths. Don't have time to test right now. Will try to do so later.
Comment #39
ging74ru CreditAttribution: ging74ru commented#37 works!
Comment #40
rszrama CreditAttribution: rszrama commented(See also the related issue linked in comment 32 above.)
Comment #41
j_ten_man CreditAttribution: j_ten_man commented#1253114: Notice: unserialize() [function.unserialize]: Error at offset 0 of 5 bytes does in fact fix the issue for me. I didn't clear my cache after applying the patch previously.
To fix the issue:
- Apply http://drupal.org/node/1253114#comment-5497816
- Flush caches
Comment #42
rszrama CreditAttribution: rszrama commentedOk, great. I'm reworking that patch and want to get an update function in and will post it asap - hopefully this evening. If we can get another confirmation, let's close this one out as a duplicate.
Comment #43
no2e CreditAttribution: no2e commentedI use Filefield Paths and have applied this patch → no problem for me.
Comment #44
rszrama CreditAttribution: rszrama commentedWonderful, let's go ahead and mark this a duplicate then. The rework of the patch will keep the same logic but just use two separate API functions instead of a single generic "prepare" function. It should include an upgrade path, too, that simply clears out illegitimate data columns.
Comment #45
MurzConfirm that patch from #26 http://drupal.org/node/1253114#comment-5497816 solves the problem for me, also fix issue #1446000: Unsupported operand types in commerce/modules/cart/commerce_cart.module on line 830 - after adding to cart.