Woocomerce Bug #3135

anapinhoabe opened this Issue May 9, 2013 · 20 comments

8 participants


I was working on my wordpress page (www.polvolula.com) when suddenly I found that I couldn't access the page anymore. On the screen it appears:

"Fatal error: Cannot unset string offsets in /home/polvolul/public_html/wp-content/plugins/woocommerce/classes/abstracts/abstract-wc-session.php on line 66"

I have been having this bug for days now. In about 2 days time it disapears, only to appear again at a random moment.

I check the page in question but I didn't edited it ever. The code says:

public function __unset( $property ) {
    if ( isset( $this->_data[ $property ] ) ) {
        unset( $this->_data[ $property ] );
        $this->_dirty = true;

I performed a little test by erasing the entire if and the error was gone, but the page wasn’t working properly (needs this function to work).

I can access the wp-admin page and when I click on Deactivate the woocomerce plugin the error disappears but, of course, my website can't work without the woocomerce plugin. The same thing happens when I delete the woocomerce files of the server.

I tried to update it, delete it and installing it again, all to now use.

I would appreciate some help! There is no info on the internet about this bug and I have been having this problems for over a week now, I don't really know what to do.


@anapinhoabe Are you aware of the fact that it's not a WooCommerce install you are linking to?

We will look at this issue soon.


Yes I am aware. I waited too long for a reply, and I had to present the work for my boss so I switched to magento service.


@anapinhoabe Were you using anything like a custom sessions implementation on top of that abstract?

Traced it back completely:

I see no way how this can turn into a string, without a custom sessions implementation or changing the _wc_session_ values in the options table.

cc @mikejolley


I didn't edit anything to do with sessions. I only edit some css and texts, so no I don't think so.


Support asked me to log my error as well. Not sure if a new issue needs to be added, but for now, the error I got (2 days ago) is the same as above:

"Fatal error: Cannot unset string offsets in ... public_html/wp-content/plugins/woocommerce/classes/abstracts/abstract-wc-session.php on line 66"

I am using the Woocommerce cart based plugin and it has been activated for about a month now. I did, however, go into the shipping settings and make a change two days ago. (I also had updated to the latest Canvas 5.2.5 version). Per the author's suggestion to remove the 'method title' in the plugin, I could possibly try adding &nbsp in the field. He said people have used this to allow for the title to be hidden and the plugin to still display correctly. Once I did this, I immediately got the error. I could access wp_admin, but not the site itself.

The site would display in Chrome, but not in Firefox or Safari. I removed all Woocommerce plugins and reactivated, but no luck. I decided to walk away from it for awhile and after a few hours, the site came back up.

Again, support suggested I log this here with exact steps.


@mikejolley mikejolley added a commit that referenced this issue May 28, 2013
@mikejolley mikejolley Cannot find cause of #3135 - added try catch to prevent fatal errors …
…and inform admin of issue if debug is on

@coenjacobs I don't know if you want to keep this as a preventitive
measure? Should stop bad code breaking things anyway.

@mikejolley Yeah we should probably keep this as a failsafe.


Not sure if that was the final fix mentioned above, but I entered the new code into the file and I get the same error. Can't access the site now.


Any luck fixing this issue ?

WooThemes member

@elleb28 you must have entered it wrongly then, because the try catch won't show a fatal error anymore.


@mikejolley I took the entire file you've posted and it is still giving me the error anytime I add a non-breaking space to the method title field in woocommerce's shipping settings, in the woocommerce cart based plugin settings, actually. I see it make the change and then almost immediately the site gives me that error. I obviously can't add that to the title field, but I'm just letting you know I'm getting that error.

WooThemes member

Don't take the entire file - remove the lines in red, and add the lines in green. Then, if the error does occur, it won't give a fatal error - it will add an error message stating the problem.

Core wouldn't cause theses issues by the way - you must have a plugin calling the session class wrong.


I've tried it both ways. The second time I tried the entire file. Must be a plugin then.

WooThemes member

Please go to WooCommerce > System Status, click the "Generate Report" button and copy/paste the info here.



WC Version: 2.0.10

WC Database Version: 2.0.10

WP Version: WP 3.5.1

Web Server Info: Apache

PHP Version: 5.2.17

MySQL Version: 5.0.96-community-log

WP Memory Limit: 96 MB

WP Debug Mode: No

WP Max Upload Size: 128 MB

PHP Post Max Size: 128 MB

PHP Time Limit: 240

WC Logging: Log directory is writable.

fsockopen/cURL: Your server has fsockopen and cURL enabled.

SOAP Client: Your server has the SOAP Client class enabled.

WP Remote Post: wp_remote_post() was successful - PayPal IPN is working.


Installed Plugins: All in one Favicon by Arne Franken version 4.3, Block Bad Queries (BBQ) by Jeff Starr version 20130103, CodeStyling Localization by Heiko Rabe version 1.99.30, Display widgets by Strategy11 version 1.24, Google Analytics Tracking For Forms by HelpForWP version 1.5.2, Gravity Forms CSS Ready Class Selector by Brad Vincent version 1.1, Gravity Forms Data Persistence Add-On by Astha Team version 3.0, Gravity Forms by rocketgenius version 1.7.2, Image Widget by Modern Tribe, Inc. version 4.0.7, Login Logo by Mark Jaquith version 0.7, MP6 by version 0.2, Post Content Shortcodes by cgrymala version 0.3.3, Regenerate Thumbnails by Viper007Bond version 2.2.4, Shortcode Reference by Bart Stroeken version 0.2, Simply Hide Pages by Julien Viard de Galbert version 1.0, Category Order and Taxonomy Terms Order by Nsp-Code version 1.3.0, Taxonomy Widget by Michael Fields version 0.6.1, Ultimate Security Checker by Eugene Pyvovarov version 2.7.8, Ultimate Taxonomy Manager by XYDAC version 2.0, WooCommerce Admin Bar Addition by David Decker - DECKERWEB version 2.4, WooCommerce Cart-Based Shipping by Erica Dion version 2.2, WooCommerce Custom Product Tabs Lite by SkyVerge version 1.2.2, WooCommerce Custom Status by Garman Technical Services version 1.0, WooCommerce Print Invoices & Delivery Notes by Steve Clark, Triggvy Gunderson, David Decker version 2.0.1, WooCommerce Braintree TR Payment Gateway by SkyVerge version 1.3.1, WooCommerce Sequential Order Numbers by SkyVerge version 1.3, WooCommerce by WooThemes version 2.0.10, WooDojo by WooThemes version 1.5.2, WooSidebars - Sidebar Manager to WooSidebars Converter by WooThemes version 1.1.1, WooSidebars by WooThemes version 1.2.2, WooThemes Updater by WooThemes version 1.0.4, WordPress Importer by wordpressdotorg version 0.6.1, WP Better Emails by ArtyShow version 0.2.5, WP-Mail-SMTP by Callum Macdonald version 0.9.1, WP Show IDs by PriMoThemes.com / WebSharks, Inc. version 110709


Force SSL: Yes

WC Pages

Shop Base: #1898 - /collection/

Cart: #1991 - /cart/

Checkout: #1996 - /checkout/

Pay: #1997 - /checkout/pay/

Thanks: #1998 - /checkout/thanks/

My Account: #611 - /my-account/

Edit Address: #1993 - /my-account/edit-address/

View Order: #1995 - /my-account/view-order/

Change Password: #1994 - /my-account/change-password/

Lost Password: #2671 - /my-account/lost-password/

WC Taxonomies

Order Statuses: pending (pending), on-hold (on-hold), processing (processing), completed (completed), refunded (refunded), cancelled (cancelled), failed (failed)

Product Types: simple (simple), grouped (grouped), configurable (configurable), downloadable (downloadable), virtual (virtual), variable (variable), external (external)


Template Overrides: /woocommerce/cart/cart.php, /woocommerce/cart/cross-sells.php, /woocommerce/cart/totals.php, /woocommerce/checkout/form-checkout.php, /woocommerce/checkout/review-order.php, /woocommerce/checkout/thankyou.php, /woocommerce/content-product.php, /woocommerce/emails/admin-new-order.php, /woocommerce/emails/customer-completed-order.php, /woocommerce/emails/customer-invoice.php, /woocommerce/emails/customer-new-account.php, /woocommerce/emails/customer-note.php, /woocommerce/emails/customer-processing-order.php, /woocommerce/emails/customer-reset-password.php, /woocommerce/emails/email-addresses.php, /woocommerce/emails/email-footer.php, /woocommerce/emails/email-header.php, /woocommerce/emails/email-order-items.php, /woocommerce/emails/plain/admin-new-order.php, /woocommerce/emails/plain/customer-completed-order.php, /woocommerce/emails/plain/customer-invoice.php, /woocommerce/emails/plain/customer-new-account.php, /woocommerce/emails/plain/customer-note.php, /woocommerce/emails/plain/customer-processing-order.php, /woocommerce/emails/plain/customer-reset-password.php, /woocommerce/emails/plain/email-addresses.php, /woocommerce/emails/plain/email-order-items.php, /woocommerce/myaccount/my-orders.php, /woocommerce/single-product/add-to-cart/quantity.php, /woocommerce/single-product/meta.php, /woocommerce/single-product/product-thumbnails.php, /woocommerce/single-product/short-description.php, /woocommerce/single-product/up-sells.php


could BBQ be the culprit here forcing the long string url to be blocked?

Block Bad Queries (BBQ) by Jeff Starr version 20130103,


I deactivated the BBQ plugin and made the same change to woocommerce shipping and it gave me the same error.


Does anyone find a solution?
I have the same problem!
Its arose when i updated my woocommerce plugin.
Re-installing and @mikejolley's solution doesnt help.
But, if i replace woocommerce folder(i dont update it yet) from my another website, problem dissapears.


Just wanted to add my "me too".

I was adjusting the flat rate shipping settings and set the method title to " " (without the quotes). When I did, my site displayed � (question mark inside a black diamond) as the method title. When I removed the   and entered a normal text, I got the following error on all my pages:

"Fatal error: Cannot unset string offsets in (...)/wp-content/plugins/woocommerce/classes/abstracts/abstract-wc-session.php on line 66"

No matter what I changed the method title too, the error would not go away and my entire site became unavailable.

To get my site back up again, I changed line 66 in abstract-wc-session.php from

  unset( $this->_data[ $property ] ); 


  if( is_array( $this->_data ) ) unset( $this->_data[ $property ] );

None of the WooCommerce pages are working but at least the rest of the site does.


Just wanted to add, with the above change in abstract-wc-session.php, all my catalog/product pages now display this at the top:


Then when I add a product to my cart, the cart stays empty. Oddly enough this only happens in Firefox. In Internet Explorer, everything works just fine.


I did some more investigating and apparently "something" (perhaps setting the method title to  ) caused a malformed session record in the wp_options table (in the WordPress database).

I had changed the entire __unset() function in abstract-wc-session.php into this:

  public function __unset( $property ) {
    if( isset( $this->_data[ $property ] ) ) {
      if( is_array( $this->_data ) ) {
        unset( $this->_data[ $property ] );
      } else {
        die( $property . " = " . $this->_data );
      $this->_dirty = true;

It then died with this message:

 errors = :24:{s:4:"cart";a:1:{s:32:"19f3cd308f1455b3fa09a282e0d496f4";a:8:{s:10:"product_id";i:251; (snip) }

To me that looked like it was missing an "a" at the beginning signalling the string is to be converted into an array.

So I checked the wp_options table, I found a field called "WP_SESSION_1" wich contained that exact string with the missing "a".

But apparently, it had something to do with the current session (which also explains why I didn't get any errors in Internet Explorer) so I deleted all my site's cookies in Firefox and now everything is working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment