private function unserialize($string)
    {
        if (false === $string || null === $string || '' === $string) {
            throw new \InvalidArgumentException('Unable to unserialize value.');
        }
        set_error_handler(
            function () {
                restore_error_handler();
                throw new \InvalidArgumentException('Unable to unserialize value, string is corrupted.');
            },
            E_NOTICE
        );
        $result = unserialize($string);
        restore_error_handler();

        return $result;
    }
private function unserialize($string)
    {
        if (false === $string || null === $string || '' === $string) {
            throw new \InvalidArgumentException('Unable to unserialize value.');
        }
        set_error_handler(
            function () {
                restore_error_handler();
                throw new \InvalidArgumentException('Unable to unserialize value, string is corrupted.');
            },
            E_NOTICE
        );
        $result = unserialize($string);
        restore_error_handler();

        return $result;
    }
private function unserialize ( $ string ) { if ( false === $ string || null === $ string || '' === $ string ) { throw new \ InvalidArgumentException ( 'Unable to unserialize value.' ) ; } set_error_handler ( function ( ) { restore_error_handler ( ) ; throw new \ InvalidArgumentException ( 'Unable to unserialize value, string is corrupted.' ) ; } , E_NOTICE ) ; $ result = unserialize ( $ string ) ; restore_error_handler ( ) ; return $ result ; }
Uses the old school unserialization

@param string $string

@return array
@throws \InvalidArgumentException
Uses the old school unserialization