WordPress.org

Support

Support » Plugins and Hacks » PHP Notice in unserialize ( secure.php line 20 )

PHP Notice in unserialize ( secure.php line 20 )

  • When you active WP_DEBUG, ajax request fails due to the php notice throws by unserialize p.e. in Woocommerce.

    The original code is:

    $data = base64_decode( $HTTP_RAW_POST_DATA );
    if( $data ) {
      $unserialized_data = @unserialize( $data );
      if( isset( $unserialized_data['iwp_action'] ) ) {
         $iwp_action = $unserialized_data['iwp_action'];
      }
    }

    My suggested code is:

    $data = base64_decode( $HTTP_RAW_POST_DATA );
    if( !empty($data) ) {
      $unserialized_data = @unserialize( $data );
      if( is_array( $unserialized_data ) &&
          isset( $unserialized_data['iwp_action'] ) ) {
    	$iwp_action = $unserialized_data['iwp_action'];
      }
    }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    http://wordpress.org/extend/plugins/better-wp-security/

  • The topic ‘PHP Notice in unserialize ( secure.php line 20 )’ is closed to new replies.