public static function unserialize($serialized)
    {
        if (!is_string($serialized)) {
            throw UnserializationFailedException::forValue($serialized);
        }

        $errorMessage = null;
        $errorCode = 0;

        set_error_handler(function ($errno, $errstr) use (&$errorMessage, &$errorCode) {
            $errorMessage = $errstr;
            $errorCode = $errno;
        });

        $value = unserialize($serialized);

        restore_error_handler();

        if (null !== $errorMessage) {
            if (false !== $pos = strpos($errorMessage, '): ')) {
                // cut "unserialize(%path%):" to make message more readable
                $errorMessage = substr($errorMessage, $pos + 3);
            }

            throw UnserializationFailedException::forValue($serialized, $errorMessage, $errorCode);
        }

        return $value;
    }
public static function unserialize($serialized)
    {
        if (!is_string($serialized)) {
            throw UnserializationFailedException::forValue($serialized);
        }

        $errorMessage = null;
        $errorCode = 0;

        set_error_handler(function ($errno, $errstr) use (&$errorMessage, &$errorCode) {
            $errorMessage = $errstr;
            $errorCode = $errno;
        });

        $value = unserialize($serialized);

        restore_error_handler();

        if (null !== $errorMessage) {
            if (false !== $pos = strpos($errorMessage, '): ')) {
                // cut "unserialize(%path%):" to make message more readable
                $errorMessage = substr($errorMessage, $pos + 3);
            }

            throw UnserializationFailedException::forValue($serialized, $errorMessage, $errorCode);
        }

        return $value;
    }
public static function unserialize ( $ serialized ) { if ( ! is_string ( $ serialized ) ) { throw UnserializationFailedException :: forValue ( $ serialized ) ; } $ errorMessage = null ; $ errorCode = 0 ; set_error_handler ( function ( $ errno , $ errstr ) use ( & $ errorMessage , & $ errorCode ) { $ errorMessage = $ errstr ; $ errorCode = $ errno ; } ) ; $ value = unserialize ( $ serialized ) ; restore_error_handler ( ) ; if ( null !== $ errorMessage ) { if ( false !== $ pos = strpos ( $ errorMessage , '): ' ) ) { // cut "unserialize(%path%):" to make message more readable $ errorMessage = substr ( $ errorMessage , $ pos + 3 ) ; } throw UnserializationFailedException :: forValue ( $ serialized , $ errorMessage , $ errorCode ) ; } return $ value ; }
Unserializes a value.

@param mixed $serialized The serialized value.

@return string The unserialized value.

@throws UnserializationFailedException If the value cannot be unserialized.
Unserializes a value .