Server IP : 85.214.239.14 / Your IP : 18.224.69.44 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/wordpress/phpMyAdmin/vendor/symfony/cache/Marshaller/ |
Upload File : |
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Cache\Marshaller; use Symfony\Component\Cache\Exception\CacheException; /** * Serializes/unserializes values using igbinary_serialize() if available, serialize() otherwise. * * @author Nicolas Grekas <p@tchwork.com> */ class DefaultMarshaller implements MarshallerInterface { private $useIgbinarySerialize = true; public function __construct(bool $useIgbinarySerialize = null) { if (null === $useIgbinarySerialize) { $useIgbinarySerialize = \extension_loaded('igbinary') && (\PHP_VERSION_ID < 70400 || version_compare('3.1.0', phpversion('igbinary'), '<=')); } elseif ($useIgbinarySerialize && (!\extension_loaded('igbinary') || (\PHP_VERSION_ID >= 70400 && version_compare('3.1.0', phpversion('igbinary'), '>')))) { throw new CacheException(\extension_loaded('igbinary') && \PHP_VERSION_ID >= 70400 ? 'Please upgrade the "igbinary" PHP extension to v3.1 or higher.' : 'The "igbinary" PHP extension is not loaded.'); } $this->useIgbinarySerialize = $useIgbinarySerialize; } /** * {@inheritdoc} */ public function marshall(array $values, ?array &$failed): array { $serialized = $failed = []; foreach ($values as $id => $value) { try { if ($this->useIgbinarySerialize) { $serialized[$id] = igbinary_serialize($value); } else { $serialized[$id] = serialize($value); } } catch (\Exception $e) { $failed[] = $id; } } return $serialized; } /** * {@inheritdoc} */ public function unmarshall(string $value) { if ('b:0;' === $value) { return false; } if ('N;' === $value) { return null; } static $igbinaryNull; if ($value === ($igbinaryNull ?? $igbinaryNull = \extension_loaded('igbinary') && (\PHP_VERSION_ID < 70400 || version_compare('3.1.0', phpversion('igbinary'), '<=')) ? igbinary_serialize(null) : false)) { return null; } $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); try { if (':' === ($value[1] ?? ':')) { if (false !== $value = unserialize($value)) { return $value; } } elseif (false === $igbinaryNull) { throw new \RuntimeException('Failed to unserialize values, did you forget to install the "igbinary" extension?'); } elseif (null !== $value = igbinary_unserialize($value)) { return $value; } throw new \DomainException(error_get_last() ? error_get_last()['message'] : 'Failed to unserialize values.'); } catch (\Error $e) { throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); } finally { ini_set('unserialize_callback_func', $unserializeCallbackHandler); } } /** * @internal */ public static function handleUnserializeCallback($class) { throw new \DomainException('Class not found: '.$class); } }