CoreFiles by mySites.guru
Unserialize.php39 lines, 1,196 bytes, from Joomla_3.10.0-Stable-Full_Package.zip
Raw History Compare with 3.9.28
md5
cf7337c3286154f2174f6cc1dcc257cc
sha1
0a65a6a40be3c02fc5d83b9a382f98d9bbbb9b87
sha256
ff6527c735c67deeb016f2d6dfcc976220a778ab56eaa0e3b1cb3d04f8f3e92f
<?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 40 releases, Joomla 3.9.22-rc to 3.10.12. See them all, or every version of this file.