private static function unserializeValue( &$string ) {
		$error = null;
		set_error_handler( function ( $errno, $errstr ) use ( &$error ) {
			$error = $errstr;
			return true;
		} );
		$ret = unserialize( $string );
		restore_error_handler();

		if ( $error !== null ) {
			self::$logger->error( 'Value unserialization failed: ' . $error );
			return [ false, null ];
		}

		$serialized = serialize( $ret );
		$l = strlen( $serialized );
		if ( substr( $string, 0, $l ) !== $serialized ) {
			self::$logger->error(
				'Value unserialization failed: read value does not match original string'
			);
			return [ false, null ];
		}

		$string = substr( $string, $l );
		return [ true, $ret ];
	}
private static function unserializeValue( &$string ) {
		$error = null;
		set_error_handler( function ( $errno, $errstr ) use ( &$error ) {
			$error = $errstr;
			return true;
		} );
		$ret = unserialize( $string );
		restore_error_handler();

		if ( $error !== null ) {
			self::$logger->error( 'Value unserialization failed: ' . $error );
			return [ false, null ];
		}

		$serialized = serialize( $ret );
		$l = strlen( $serialized );
		if ( substr( $string, 0, $l ) !== $serialized ) {
			self::$logger->error(
				'Value unserialization failed: read value does not match original string'
			);
			return [ false, null ];
		}

		$string = substr( $string, $l );
		return [ true, $ret ];
	}
private static function unserializeValue ( & $ string ) { $ error = null ; set_error_handler ( function ( $ errno , $ errstr ) use ( & $ error ) { $ error = $ errstr ; return true ; } ) ; $ ret = unserialize ( $ string ) ; restore_error_handler ( ) ; if ( $ error !== null ) { self :: $ logger -> error ( 'Value unserialization failed: ' . $ error ) ; return [ false , null ] ; } $ serialized = serialize ( $ ret ) ; $ l = strlen ( $ serialized ) ; if ( substr ( $ string , 0 , $ l ) !== $ serialized ) { self :: $ logger -> error ( 'Value unserialization failed: read value does not match original string' ) ; return [ false , null ] ; } $ string = substr ( $ string , $ l ) ; return [ true , $ ret ] ; }
Unserialize a value with error logging
@param string &$string On success, the portion used is removed
@return array ( bool $success, mixed $value )
Unserialize a value with error logging