WordPress.org

Ready to get started?Download WordPress

Forums

iThemes Security (formerly Better WP Security)
PHP Notice in unserialize ( secure.php line 20 ) (1 post)

  1. myefreelance
    Member
    Posted 1 year ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic