public static function decode( $data ) {
		if ( !is_string( $data ) ) {
			throw new \InvalidArgumentException( '$data must be a string' );
		}

		$format = ini_get( 'session.serialize_handler' );
		if ( !is_string( $format ) ) {
			throw new \UnexpectedValueException(
				'Could not fetch the value of session.serialize_handler'
			);
		}
		switch ( $format ) {
			case 'php':
				return self::decodePhp( $data );

			case 'php_binary':
				return self::decodePhpBinary( $data );

			case 'php_serialize':
				return self::decodePhpSerialize( $data );

			default:
				throw new \DomainException( "Unsupported format \"$format\"" );
		}
	}
public static function decode( $data ) {
		if ( !is_string( $data ) ) {
			throw new \InvalidArgumentException( '$data must be a string' );
		}

		$format = ini_get( 'session.serialize_handler' );
		if ( !is_string( $format ) ) {
			throw new \UnexpectedValueException(
				'Could not fetch the value of session.serialize_handler'
			);
		}
		switch ( $format ) {
			case 'php':
				return self::decodePhp( $data );

			case 'php_binary':
				return self::decodePhpBinary( $data );

			case 'php_serialize':
				return self::decodePhpSerialize( $data );

			default:
				throw new \DomainException( "Unsupported format \"$format\"" );
		}
	}
public static function decode ( $ data ) { if ( ! is_string ( $ data ) ) { throw new \ InvalidArgumentException ( '$data must be a string' ) ; } $ format = ini_get ( 'session.serialize_handler' ) ; if ( ! is_string ( $ format ) ) { throw new \ UnexpectedValueException ( 'Could not fetch the value of session.serialize_handler' ) ; } switch ( $ format ) { case 'php' : return self :: decodePhp ( $ data ) ; case 'php_binary' : return self :: decodePhpBinary ( $ data ) ; case 'php_serialize' : return self :: decodePhpSerialize ( $ data ) ; default : throw new \ DomainException ( "Unsupported format \"$format\"" ) ; } }
Decode a session string to an array, using the format in session.serialize_handler
@param string $data Session data. Use the same caution in passing
user-controlled data here that you would to PHP's unserialize function.
@return array|null Data, or null on failure
@throws \\DomainException
@throws \\InvalidArgumentException
Decode a session string to an array using the format in session . serialize_handler