CoreFiles by mySites.guru
Unserialize.php39 lines, 1,235 bytes, from Joomla_3.10.0-rc2-Release_Candidate-Full_Package.zip
Raw History Compare with 3.10.0-rc1
md5
e587d7ed60bc9d802d79c0f40e552bf6
sha1
81b9abdfe3eb866152bd12bb66fb6155126601f9
sha256
ec25f121f9d670868d92881a540ef67784688e48d86c94867fc461584ed1736c
<?php

namespace Brumann\Polyfill;

final class Unserialize
{
    /**
     * @see https://secure.php.net/manual/en/function.unserialize.php
     *
     * @param string $serialized Serialized data
     * @param array $options Associative array containing options
     *
     * @return mixed
     */
    public static function unserialize($serialized, array $options = array())
    {
        if (PHP_VERSION_ID >= 70000) {
            return \unserialize($serialized, $options);
        }
        if (!array_key_exists('allowed_classes', $options) || true === $options['allowed_classes']) {
            return \unserialize($serialized);
        }
        $allowedClasses = $options['allowed_classes'];
        if (false === $allowedClasses) {
            $allowedClasses = array();
        }
        if (!is_array($allowedClasses)) {
            $allowedClasses = array();
            trigger_error(
                'unserialize(): allowed_classes option should be array or boolean',
                E_USER_WARNING
            );
        }

        $worker = new DisallowedClassesSubstitutor($serialized, $allowedClasses);

        return \unserialize($worker->getSubstitutedSerialized());
    }
}

The same content is in 8 releases, Joomla 3.10.0-alpha4 to 3.10.0-rc2. See them all, or every version of this file.