Permalink
Browse files

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.
  • Loading branch information...
1 parent 559d7b9 commit a18ab45178318f6e7f42fe4959b7dec4d7323cb5 @mikejolley mikejolley committed May 28, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 classes/abstracts/abstract-wc-session.php
@@ -63,8 +63,13 @@ public function __isset( $property ) {
*/
public function __unset( $property ) {
if ( isset( $this->_data[ $property ] ) ) {
- unset( $this->_data[ $property ] );
- $this->_dirty = true;
+ try {
+ unset( $this->_data[ $property ] );
+ $this->_dirty = true;
+ } catch( Exception $e ) {
+ if ( defined( 'WP_DEBUG' ) && WP_DEBUG )
+ $GLOBALS['woocommerce']->add_error( "Error: Cannot unset " . strval( $property ) . " - " . $e->getMessage() );
+ }
}
}

0 comments on commit a18ab45

Please sign in to comment.