diff --git a/.travis.yml b/.travis.yml index 721e5410cbb..dd33dca86d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -277,7 +277,10 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ + --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony --exclude htdocs/includes/mike42/escpos-php/example \ + --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo diff --git a/composer.json b/composer.json index 3a1f895506e..9fede994525 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,8 @@ "tecnickcom/tcpdf" : "6.3.2", "nnnick/chartjs" : "^2.9", "stripe/stripe-php" : "6.43.1", - "maximebf/debugbar" : "1.15.1" + "maximebf/debugbar" : "1.15.1", + "symfony/var-dumper": "3" }, "require-dev" : { "php-parallel-lint/php-parallel-lint" : "^0", diff --git a/composer.lock b/composer.lock index f4372a3fb45..5afe0ca34f2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9a83e3eaefb0843af09f39b0bc958a90", + "content-hash": "1dbd2d05cc0836acfca5988f29005cf2", "packages": [ { "name": "ckeditor/ckeditor", @@ -555,201 +555,34 @@ ], "time": "2020-07-14T12:35:20+00:00" }, - { - "name": "symfony/polyfill-php72", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "639447d008615574653fb3bc60d1986d7172eaae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae", - "reference": "639447d008615574653fb3bc60d1986d7172eaae", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "shasum": "" - }, - "require": { - "php": ">=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, { "name": "symfony/var-dumper", - "version": "v4.4.13", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "1bef32329f3166486ab7cb88599cae4875632b99" + "reference": "737e07704cca83f9dd0af926d45ce27eedc25657" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1bef32329f3166486ab7cb88599cae4875632b99", - "reference": "1bef32329f3166486ab7cb88599cae4875632b99", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/737e07704cca83f9dd0af926d45ce27eedc25657", + "reference": "737e07704cca83f9dd0af926d45ce27eedc25657", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5", - "symfony/polyfill-php80": "^1.15" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { - "ext-iconv": "*", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/process": "^4.4|^5.0", - "twig/twig": "^1.34|^2.4|^3.0" + "twig/twig": "~1.20|~2.0" }, "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + "ext-symfony_debug": "" }, - "bin": [ - "Resources/bin/var-dump-server" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -783,21 +616,7 @@ "debug", "dump" ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-08-17T07:31:35+00:00" + "time": "2015-11-18T13:48:51+00:00" }, { "name": "tecnickcom/tcpdf", @@ -2218,6 +2037,159 @@ ], "time": "2019-08-06T08:03:45+00:00" }, + { + "name": "symfony/polyfill-php72", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "639447d008615574653fb3bc60d1986d7172eaae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae", + "reference": "639447d008615574653fb3bc60d1986d7172eaae", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981", + "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981", + "shasum": "" + }, + "require": { + "php": ">=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, { "name": "symfony/yaml", "version": "v3.4.32", diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 36399534eb6..05038c13bbc 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -114,16 +114,29 @@ if (!function_exists("session_id")) } print ''; + print '
- */ -class ArgsStub extends EnumStub -{ - private static $parameters = []; - - public function __construct(array $args, string $function, ?string $class) - { - list($variadic, $params) = self::getParameters($function, $class); - - $values = []; - foreach ($args as $k => $v) { - $values[$k] = !is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v; - } - if (null === $params) { - parent::__construct($values, false); - - return; - } - if (\count($values) < \count($params)) { - $params = \array_slice($params, 0, \count($values)); - } elseif (\count($values) > \count($params)) { - $values[] = new EnumStub(array_splice($values, \count($params)), false); - $params[] = $variadic; - } - if (['...'] === $params) { - $this->dumpKeys = false; - $this->value = $values[0]->value; - } else { - $this->value = array_combine($params, $values); - } - } - - private static function getParameters(string $function, ?string $class): array - { - if (isset(self::$parameters[$k = $class.'::'.$function])) { - return self::$parameters[$k]; - } - - try { - $r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function); - } catch (\ReflectionException $e) { - return [null, null]; - } - - $variadic = '...'; - $params = []; - foreach ($r->getParameters() as $v) { - $k = '$'.$v->name; - if ($v->isPassedByReference()) { - $k = '&'.$k; - } - if ($v->isVariadic()) { - $variadic .= $k; - } else { - $params[] = $k; - } - } - - return self::$parameters[$k] = [$variadic, $params]; - } -} diff --git a/htdocs/includes/symfony/var-dumper/Caster/Caster.php b/htdocs/includes/symfony/var-dumper/Caster/Caster.php index 4bdc66ac5bc..23e72e87701 100644 --- a/htdocs/includes/symfony/var-dumper/Caster/Caster.php +++ b/htdocs/includes/symfony/var-dumper/Caster/Caster.php @@ -11,14 +11,10 @@ namespace Symfony\Component\VarDumper\Caster; -use Symfony\Component\VarDumper\Cloner\Stub; - /** * Helper for filtering out properties in casters. * * @author Nicolas Grekas
- * - * @final */ class Caster { @@ -40,70 +36,29 @@ class Caster /** * Casts objects to arrays and adds the dynamic property prefix. * - * @param object $obj The object to cast - * @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not + * @param object $obj The object to cast. + * @param \ReflectionClass $reflector The class reflector to use for inspecting the object definition. * - * @return array The array-cast of the object, with prefixed dynamic properties + * @return array The array-cast of the object, with prefixed dynamic properties. */ - public static function castObject($obj, string $class, bool $hasDebugInfo = false, string $debugClass = null): array + public static function castObject($obj, \ReflectionClass $reflector) { - if ($hasDebugInfo) { - try { - $debugInfo = $obj->__debugInfo(); - } catch (\Exception $e) { - // ignore failing __debugInfo() - $hasDebugInfo = false; - } - } - - $a = $obj instanceof \Closure ? [] : (array) $obj; - - if ($obj instanceof \__PHP_Incomplete_Class) { - return $a; + if ($reflector->hasMethod('__debugInfo')) { + $a = $obj->__debugInfo(); + } else { + $a = (array) $obj; } if ($a) { - static $publicProperties = []; - $debugClass = $debugClass ?? get_debug_type($obj); - - $i = 0; - $prefixedKeys = []; - foreach ($a as $k => $v) { - if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) { - if (!isset($publicProperties[$class])) { - foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) { - $publicProperties[$class][$prop->name] = true; - } - } - if (!isset($publicProperties[$class][$k])) { - $prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k; - } - } elseif ($debugClass !== $class && 1 === strpos($k, $class)) { - $prefixedKeys[$i] = "\0".$debugClass.strrchr($k, "\0"); + $p = array_keys($a); + foreach ($p as $i => $k) { + if (!isset($k[0]) || ("\0" !== $k[0] && !$reflector->hasProperty($k))) { + $p[$i] = self::PREFIX_DYNAMIC.$k; + } elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) { + $p[$i] = "\0".$reflector->getParentClass().'@anonymous'.strrchr($k, "\0"); } - ++$i; - } - if ($prefixedKeys) { - $keys = array_keys($a); - foreach ($prefixedKeys as $i => $k) { - $keys[$i] = $k; - } - $a = array_combine($keys, $a); - } - } - - if ($hasDebugInfo && \is_array($debugInfo)) { - foreach ($debugInfo as $k => $v) { - if (!isset($k[0]) || "\0" !== $k[0]) { - if (\array_key_exists(self::PREFIX_DYNAMIC.$k, $a)) { - continue; - } - $k = self::PREFIX_VIRTUAL.$k; - } - - unset($a[$k]); - $a[$k] = $v; } + $a = array_combine($p, $a); } return $a; @@ -115,30 +70,27 @@ class Caster * By default, a single match in the $filter bit field filters properties out, following an "or" logic. * When EXCLUDE_STRICT is set, an "and" logic is applied: all bits must match for a property to be removed. * - * @param array $a The array containing the properties to filter - * @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out - * @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set - * @param int &$count Set to the number of removed properties + * @param array $a The array containing the properties to filter. + * @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out. + * @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set. * * @return array The filtered array */ - public static function filter(array $a, int $filter, array $listedProperties = [], ?int &$count = 0): array + public static function filter(array $a, $filter, array $listedProperties = array()) { - $count = 0; - foreach ($a as $k => $v) { $type = self::EXCLUDE_STRICT & $filter; if (null === $v) { $type |= self::EXCLUDE_NULL & $filter; - $type |= self::EXCLUDE_EMPTY & $filter; - } elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || [] === $v) { + } + if (empty($v)) { $type |= self::EXCLUDE_EMPTY & $filter; } - if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) { + if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) { $type |= self::EXCLUDE_NOT_IMPORTANT; } - if ((self::EXCLUDE_VERBOSE & $filter) && \in_array($k, $listedProperties, true)) { + if ((self::EXCLUDE_VERBOSE & $filter) && in_array($k, $listedProperties, true)) { $type |= self::EXCLUDE_VERBOSE; } @@ -156,20 +108,9 @@ class Caster if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) { unset($a[$k]); - ++$count; } } return $a; } - - public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, bool $isNested): array - { - if (isset($a['__PHP_Incomplete_Class_Name'])) { - $stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')'; - unset($a['__PHP_Incomplete_Class_Name']); - } - - return $a; - } } diff --git a/htdocs/includes/symfony/var-dumper/Caster/ClassStub.php b/htdocs/includes/symfony/var-dumper/Caster/ClassStub.php deleted file mode 100644 index 612a7ca2d99..00000000000 --- a/htdocs/includes/symfony/var-dumper/Caster/ClassStub.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\VarDumper\Caster; - -use Symfony\Component\VarDumper\Cloner\Stub; - -/** - * Represents a PHP class identifier. - * - * @author Nicolas Grekas
- */ -class ClassStub extends ConstStub -{ - /** - * @param string $identifier A PHP identifier, e.g. a class, method, interface, etc. name - * @param callable $callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier - */ - public function __construct(string $identifier, $callable = null) - { - $this->value = $identifier; - - try { - if (null !== $callable) { - if ($callable instanceof \Closure) { - $r = new \ReflectionFunction($callable); - } elseif (\is_object($callable)) { - $r = [$callable, '__invoke']; - } elseif (\is_array($callable)) { - $r = $callable; - } elseif (false !== $i = strpos($callable, '::')) { - $r = [substr($callable, 0, $i), substr($callable, 2 + $i)]; - } else { - $r = new \ReflectionFunction($callable); - } - } elseif (0 < $i = strpos($identifier, '::') ?: strpos($identifier, '->')) { - $r = [substr($identifier, 0, $i), substr($identifier, 2 + $i)]; - } else { - $r = new \ReflectionClass($identifier); - } - - if (\is_array($r)) { - try { - $r = new \ReflectionMethod($r[0], $r[1]); - } catch (\ReflectionException $e) { - $r = new \ReflectionClass($r[0]); - } - } - - if (false !== strpos($identifier, "@anonymous\0")) { - $this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { - return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; - }, $identifier); - } - - if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) { - $s = ReflectionCaster::castFunctionAbstract($r, [], new Stub(), true, Caster::EXCLUDE_VERBOSE); - $s = ReflectionCaster::getSignature($s); - - if ('()' === substr($identifier, -2)) { - $this->value = substr_replace($identifier, $s, -2); - } else { - $this->value .= $s; - } - } - } catch (\ReflectionException $e) { - return; - } finally { - if (0 < $i = strrpos($this->value, '\\')) { - $this->attr['ellipsis'] = \strlen($this->value) - $i; - $this->attr['ellipsis-type'] = 'class'; - $this->attr['ellipsis-tail'] = 1; - } - } - - if ($f = $r->getFileName()) { - $this->attr['file'] = $f; - $this->attr['line'] = $r->getStartLine(); - } - } - - public static function wrapCallable($callable) - { - if (\is_object($callable) || !\is_callable($callable)) { - return $callable; - } - - if (!\is_array($callable)) { - $callable = new static($callable, $callable); - } elseif (\is_string($callable[0])) { - $callable[0] = new static($callable[0], $callable); - } else { - $callable[1] = new static($callable[1], $callable); - } - - return $callable; - } -} diff --git a/htdocs/includes/symfony/var-dumper/Caster/ConstStub.php b/htdocs/includes/symfony/var-dumper/Caster/ConstStub.php index 8b0179745f3..f20e03cdf0d 100644 --- a/htdocs/includes/symfony/var-dumper/Caster/ConstStub.php +++ b/htdocs/includes/symfony/var-dumper/Caster/ConstStub.php @@ -20,17 +20,9 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class ConstStub extends Stub { - public function __construct(string $name, $value = null) + public function __construct($name, $value) { $this->class = $name; - $this->value = 1 < \func_num_args() ? $value : $name; - } - - /** - * @return string - */ - public function __toString() - { - return (string) $this->value; + $this->value = $value; } } diff --git a/htdocs/includes/symfony/var-dumper/Caster/CutArrayStub.php b/htdocs/includes/symfony/var-dumper/Caster/CutArrayStub.php index 0e4fb363d2d..f2a803053a6 100644 --- a/htdocs/includes/symfony/var-dumper/Caster/CutArrayStub.php +++ b/htdocs/includes/symfony/var-dumper/Caster/CutArrayStub.php @@ -25,6 +25,6 @@ class CutArrayStub extends CutStub parent::__construct($value); $this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys)); - $this->cut -= \count($this->preservedSubset); + $this->cut -= count($this->preservedSubset); } } diff --git a/htdocs/includes/symfony/var-dumper/Caster/CutStub.php b/htdocs/includes/symfony/var-dumper/Caster/CutStub.php index 464c6dbd190..8781f5cf3c6 100644 --- a/htdocs/includes/symfony/var-dumper/Caster/CutStub.php +++ b/htdocs/includes/symfony/var-dumper/Caster/CutStub.php @@ -24,39 +24,31 @@ class CutStub extends Stub { $this->value = $value; - switch (\gettype($value)) { + switch (gettype($value)) { case 'object': $this->type = self::TYPE_OBJECT; - $this->class = \get_class($value); - - if ($value instanceof \Closure) { - ReflectionCaster::castClosure($value, [], $this, true, Caster::EXCLUDE_VERBOSE); - } - + $this->class = get_class($value); $this->cut = -1; break; case 'array': $this->type = self::TYPE_ARRAY; $this->class = self::ARRAY_ASSOC; - $this->cut = $this->value = \count($value); + $this->cut = $this->value = count($value); break; case 'resource': case 'unknown type': - case 'resource (closed)': $this->type = self::TYPE_RESOURCE; $this->handle = (int) $value; - if ('Unknown' === $this->class = @get_resource_type($value)) { - $this->class = 'Closed'; - } + $this->class = @get_resource_type($value); $this->cut = -1; break; case 'string': $this->type = self::TYPE_STRING; $this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY; - $this->cut = self::STRING_BINARY === $this->class ? \strlen($value) : mb_strlen($value, 'UTF-8'); + $this->cut = self::STRING_BINARY === $this->class ? strlen($value) : mb_strlen($value, 'UTF-8'); $this->value = ''; break; } diff --git a/htdocs/includes/symfony/var-dumper/Caster/DOMCaster.php b/htdocs/includes/symfony/var-dumper/Caster/DOMCaster.php index 41e52d6b7cc..e04cf9534b3 100644 --- a/htdocs/includes/symfony/var-dumper/Caster/DOMCaster.php +++ b/htdocs/includes/symfony/var-dumper/Caster/DOMCaster.php @@ -17,12 +17,10 @@ use Symfony\Component\VarDumper\Cloner\Stub; * Casts DOM related classes to array representation. * * @author Nicolas Grekas
- *
- * @final since Symfony 4.4
*/
class DOMCaster
{
- private static $errorCodes = [
+ private static $errorCodes = array(
DOM_PHP_ERR => 'DOM_PHP_ERR',
DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
@@ -40,9 +38,9 @@ class DOMCaster
DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR',
DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR',
DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR',
- ];
+ );
- private static $nodeTypes = [
+ private static $nodeTypes = array(
XML_ELEMENT_NODE => 'XML_ELEMENT_NODE',
XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE',
XML_TEXT_NODE => 'XML_TEXT_NODE',
@@ -61,7 +59,7 @@ class DOMCaster
XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE',
XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE',
XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
- ];
+ );
public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)
{
@@ -75,26 +73,26 @@ class DOMCaster
public static function castLength($dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'length' => $dom->length,
- ];
+ );
return $a;
}
public static function castImplementation($dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
Caster::PREFIX_VIRTUAL.'XML' => '2.0',
- ];
+ );
return $a;
}
public static function castNode(\DOMNode $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'nodeName' => $dom->nodeName,
'nodeValue' => new CutStub($dom->nodeValue),
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
@@ -109,16 +107,16 @@ class DOMCaster
'namespaceURI' => $dom->namespaceURI,
'prefix' => $dom->prefix,
'localName' => $dom->localName,
- 'baseURI' => $dom->baseURI ? new LinkStub($dom->baseURI) : $dom->baseURI,
+ 'baseURI' => $dom->baseURI,
'textContent' => new CutStub($dom->textContent),
- ];
+ );
return $a;
}
public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'nodeName' => $dom->nodeName,
'nodeValue' => new CutStub($dom->nodeValue),
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
@@ -127,14 +125,14 @@ class DOMCaster
'namespaceURI' => $dom->namespaceURI,
'ownerDocument' => new CutStub($dom->ownerDocument),
'parentNode' => new CutStub($dom->parentNode),
- ];
+ );
return $a;
}
public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, $isNested, $filter = 0)
{
- $a += [
+ $a += array(
'doctype' => $dom->doctype,
'implementation' => $dom->implementation,
'documentElement' => new CutStub($dom->documentElement),
@@ -146,7 +144,7 @@ class DOMCaster
'version' => $dom->version,
'xmlVersion' => $dom->xmlVersion,
'strictErrorChecking' => $dom->strictErrorChecking,
- 'documentURI' => $dom->documentURI ? new LinkStub($dom->documentURI) : $dom->documentURI,
+ 'documentURI' => $dom->documentURI,
'config' => $dom->config,
'formatOutput' => $dom->formatOutput,
'validateOnParse' => $dom->validateOnParse,
@@ -154,12 +152,12 @@ class DOMCaster
'preserveWhiteSpace' => $dom->preserveWhiteSpace,
'recover' => $dom->recover,
'substituteEntities' => $dom->substituteEntities,
- ];
+ );
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$formatOutput = $dom->formatOutput;
$dom->formatOutput = true;
- $a += [Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML()];
+ $a += array(Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML());
$dom->formatOutput = $formatOutput;
}
@@ -168,136 +166,136 @@ class DOMCaster
public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'data' => $dom->data,
'length' => $dom->length,
- ];
+ );
return $a;
}
public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'name' => $dom->name,
'specified' => $dom->specified,
'value' => $dom->value,
'ownerElement' => $dom->ownerElement,
'schemaTypeInfo' => $dom->schemaTypeInfo,
- ];
+ );
return $a;
}
public static function castElement(\DOMElement $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'tagName' => $dom->tagName,
'schemaTypeInfo' => $dom->schemaTypeInfo,
- ];
+ );
return $a;
}
public static function castText(\DOMText $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'wholeText' => $dom->wholeText,
- ];
+ );
return $a;
}
public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'typeName' => $dom->typeName,
'typeNamespace' => $dom->typeNamespace,
- ];
+ );
return $a;
}
public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'severity' => $dom->severity,
'message' => $dom->message,
'type' => $dom->type,
'relatedException' => $dom->relatedException,
'related_data' => $dom->related_data,
'location' => $dom->location,
- ];
+ );
return $a;
}
public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'lineNumber' => $dom->lineNumber,
'columnNumber' => $dom->columnNumber,
'offset' => $dom->offset,
'relatedNode' => $dom->relatedNode,
- 'uri' => $dom->uri ? new LinkStub($dom->uri, $dom->lineNumber) : $dom->uri,
- ];
+ 'uri' => $dom->uri,
+ );
return $a;
}
public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'name' => $dom->name,
'entities' => $dom->entities,
'notations' => $dom->notations,
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
'internalSubset' => $dom->internalSubset,
- ];
+ );
return $a;
}
public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
- ];
+ );
return $a;
}
public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
'notationName' => $dom->notationName,
'actualEncoding' => $dom->actualEncoding,
'encoding' => $dom->encoding,
'version' => $dom->version,
- ];
+ );
return $a;
}
public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'target' => $dom->target,
'data' => $dom->data,
- ];
+ );
return $a;
}
public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
'document' => $dom->document,
- ];
+ );
return $a;
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/DateCaster.php b/htdocs/includes/symfony/var-dumper/Caster/DateCaster.php
deleted file mode 100644
index 6b264c79587..00000000000
--- a/htdocs/includes/symfony/var-dumper/Caster/DateCaster.php
+++ /dev/null
@@ -1,128 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Caster;
-
-use Symfony\Component\VarDumper\Cloner\Stub;
-
-/**
- * Casts DateTimeInterface related classes to array representation.
- *
- * @author Dany Maillard
- *
- * @final since Symfony 4.4
*/
class DoctrineCaster
{
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)
{
- foreach (['__cloner__', '__initializer__'] as $k) {
- if (\array_key_exists($k, $a)) {
+ foreach (array('__cloner__', '__initializer__') as $k) {
+ if (array_key_exists($k, $a)) {
unset($a[$k]);
++$stub->cut;
}
@@ -39,8 +37,8 @@ class DoctrineCaster
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)
{
- foreach (['_entityPersister', '_identifier'] as $k) {
- if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
+ foreach (array('_entityPersister', '_identifier') as $k) {
+ if (array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
unset($a[$k]);
++$stub->cut;
}
@@ -51,8 +49,8 @@ class DoctrineCaster
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)
{
- foreach (['snapshot', 'association', 'typeClass'] as $k) {
- if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
+ foreach (array('snapshot', 'association', 'typeClass') as $k) {
+ if (array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
$a[$k] = new CutStub($a[$k]);
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/DsCaster.php b/htdocs/includes/symfony/var-dumper/Caster/DsCaster.php
deleted file mode 100644
index 11423c9b29e..00000000000
--- a/htdocs/includes/symfony/var-dumper/Caster/DsCaster.php
+++ /dev/null
@@ -1,70 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Caster;
-
-use Ds\Collection;
-use Ds\Map;
-use Ds\Pair;
-use Symfony\Component\VarDumper\Cloner\Stub;
-
-/**
- * Casts Ds extension classes to array representation.
- *
- * @author Jáchym Toušek
- */
-class DsPairStub extends Stub
-{
- public function __construct($key, $value)
- {
- $this->value = [
- Caster::PREFIX_VIRTUAL.'key' => $key,
- Caster::PREFIX_VIRTUAL.'value' => $value,
- ];
- }
-}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/EnumStub.php b/htdocs/includes/symfony/var-dumper/Caster/EnumStub.php
index 7a4e98a21b4..67bb2e16390 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/EnumStub.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/EnumStub.php
@@ -20,11 +20,8 @@ use Symfony\Component\VarDumper\Cloner\Stub;
*/
class EnumStub extends Stub
{
- public $dumpKeys = true;
-
- public function __construct(array $values, bool $dumpKeys = true)
+ public function __construct(array $values)
{
$this->value = $values;
- $this->dumpKeys = $dumpKeys;
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ExceptionCaster.php b/htdocs/includes/symfony/var-dumper/Caster/ExceptionCaster.php
index dc9ed7e322b..a5a8773e859 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/ExceptionCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/ExceptionCaster.php
@@ -11,22 +11,19 @@
namespace Symfony\Component\VarDumper\Caster;
-use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext;
-use Symfony\Component\VarDumper\Cloner\Stub;
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
+use Symfony\Component\VarDumper\Cloner\Stub;
/**
* Casts common Exception classes to array representation.
*
* @author Nicolas Grekas
- *
- * @final since Symfony 4.4
*/
class ExceptionCaster
{
public static $srcContext = 1;
public static $traceArgs = true;
- public static $errorTypes = [
+ public static $errorTypes = array(
E_DEPRECATED => 'E_DEPRECATED',
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
@@ -42,9 +39,7 @@ class ExceptionCaster
E_USER_WARNING => 'E_USER_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE',
E_STRICT => 'E_STRICT',
- ];
-
- private static $framesCache = [];
+ );
public static function castError(\Error $e, array $a, Stub $stub, $isNested, $filter = 0)
{
@@ -67,15 +62,17 @@ class ExceptionCaster
public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, $isNested)
{
- $trace = Caster::PREFIX_VIRTUAL.'trace';
$prefix = Caster::PREFIX_PROTECTED;
$xPrefix = "\0Exception\0";
- if (isset($a[$xPrefix.'previous'], $a[$trace]) && $a[$xPrefix.'previous'] instanceof \Exception) {
+ if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace'])) {
$b = (array) $a[$xPrefix.'previous'];
- $class = get_debug_type($a[$xPrefix.'previous']);
- self::traceUnshift($b[$xPrefix.'trace'], $class, $b[$prefix.'file'], $b[$prefix.'line']);
- $a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -\count($a[$trace]->value));
+ array_unshift($b[$xPrefix.'trace'], array(
+ 'function' => 'new '.get_class($a[$xPrefix.'previous']),
+ 'file' => $b[$prefix.'file'],
+ 'line' => $b[$prefix.'line'],
+ ));
+ $a[$xPrefix.'trace'] = new TraceStub($b[$xPrefix.'trace'], false, 0, -1 - count($a[$xPrefix.'trace']->value));
}
unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);
@@ -83,33 +80,6 @@ class ExceptionCaster
return $a;
}
- public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, $isNested)
- {
- $sPrefix = "\0".SilencedErrorContext::class."\0";
-
- if (!isset($a[$s = $sPrefix.'severity'])) {
- return $a;
- }
-
- if (isset(self::$errorTypes[$a[$s]])) {
- $a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
- }
-
- $trace = [[
- 'file' => $a[$sPrefix.'file'],
- 'line' => $a[$sPrefix.'line'],
- ]];
-
- if (isset($a[$sPrefix.'trace'])) {
- $trace = array_merge($trace, $a[$sPrefix.'trace']);
- }
-
- unset($a[$sPrefix.'file'], $a[$sPrefix.'line'], $a[$sPrefix.'trace']);
- $a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);
-
- return $a;
- }
-
public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, $isNested)
{
if (!$isNested) {
@@ -118,67 +88,45 @@ class ExceptionCaster
$stub->class = '';
$stub->handle = 0;
$frames = $trace->value;
- $prefix = Caster::PREFIX_VIRTUAL;
- $a = [];
- $j = \count($frames);
+ $a = array();
+ $j = count($frames);
if (0 > $i = $trace->sliceOffset) {
$i = max(0, $j + $i);
}
if (!isset($trace->value[$i])) {
- return [];
+ return array();
}
- $lastCall = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '';
- $frames[] = ['function' => ''];
- $collapse = false;
+ $lastCall = isset($frames[$i]['function']) ? ' ==> '.(isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '';
for ($j += $trace->numberingOffset - $i++; isset($frames[$i]); ++$i, --$j) {
- $f = $frames[$i];
- $call = isset($f['function']) ? (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'] : '???';
+ $call = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[$i]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '???';
- $frame = new FrameStub(
- [
- 'object' => isset($f['object']) ? $f['object'] : null,
- 'class' => isset($f['class']) ? $f['class'] : null,
- 'type' => isset($f['type']) ? $f['type'] : null,
- 'function' => isset($f['function']) ? $f['function'] : null,
- ] + $frames[$i - 1],
- false,
+ $a[Caster::PREFIX_VIRTUAL.$j.'. '.$call.$lastCall] = new FrameStub(
+ array(
+ 'object' => isset($frames[$i]['object']) ? $frames[$i]['object'] : null,
+ 'class' => isset($frames[$i]['class']) ? $frames[$i]['class'] : null,
+ 'type' => isset($frames[$i]['type']) ? $frames[$i]['type'] : null,
+ 'function' => isset($frames[$i]['function']) ? $frames[$i]['function'] : null,
+ ) + $frames[$i - 1],
+ $trace->keepArgs,
true
);
- $f = self::castFrameStub($frame, [], $frame, true);
- if (isset($f[$prefix.'src'])) {
- foreach ($f[$prefix.'src']->value as $label => $frame) {
- if (0 === strpos($label, "\0~collapse=0")) {
- if ($collapse) {
- $label = substr_replace($label, '1', 11, 1);
- } else {
- $collapse = true;
- }
- }
- $label = substr_replace($label, "title=Stack level $j.&", 2, 0);
- }
- $f = $frames[$i - 1];
- if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) {
- $frame->value['arguments'] = new ArgsStub($f['args'], isset($f['function']) ? $f['function'] : null, isset($f['class']) ? $f['class'] : null);
- }
- } elseif ('???' !== $lastCall) {
- $label = new ClassStub($lastCall);
- if (isset($label->attr['ellipsis'])) {
- $label->attr['ellipsis'] += 2;
- $label = substr_replace($prefix, "ellipsis-type=class&ellipsis={$label->attr['ellipsis']}&ellipsis-tail=1&title=Stack level $j.", 2, 0).$label->value.'()';
- } else {
- $label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$label->value.'()';
- }
- } else {
- $label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$lastCall;
- }
- $a[substr_replace($label, sprintf('separator=%s&', $frame instanceof EnumStub ? ' ' : ':'), 2, 0)] = $frame;
- $lastCall = $call;
+ $lastCall = ' ==> '.$call;
}
+ $a[Caster::PREFIX_VIRTUAL.$j.'. {main}'.$lastCall] = new FrameStub(
+ array(
+ 'object' => null,
+ 'class' => null,
+ 'type' => null,
+ 'function' => '{main}',
+ ) + $frames[$i - 1],
+ $trace->keepArgs,
+ true
+ );
if (null !== $trace->sliceLength) {
- $a = \array_slice($a, 0, $trace->sliceLength, true);
+ $a = array_slice($a, 0, $trace->sliceLength, true);
}
return $a;
@@ -193,56 +141,30 @@ class ExceptionCaster
$prefix = Caster::PREFIX_VIRTUAL;
if (isset($f['file'], $f['line'])) {
- $cacheKey = $f;
- unset($cacheKey['object'], $cacheKey['args']);
- $cacheKey[] = self::$srcContext;
- $cacheKey = implode('-', $cacheKey);
+ if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
+ $f['file'] = substr($f['file'], 0, -strlen($match[0]));
+ $f['line'] = (int) $match[1];
+ }
+ if (file_exists($f['file']) && 0 <= self::$srcContext) {
+ $src[$f['file'].':'.$f['line']] = self::extractSource(explode("\n", file_get_contents($f['file'])), $f['line'], self::$srcContext);
- if (isset(self::$framesCache[$cacheKey])) {
- $a[$prefix.'src'] = self::$framesCache[$cacheKey];
- } else {
- if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
- $f['file'] = substr($f['file'], 0, -\strlen($match[0]));
- $f['line'] = (int) $match[1];
- }
- $src = $f['line'];
- $srcKey = $f['file'];
- $ellipsis = new LinkStub($srcKey, 0);
- $srcAttr = 'collapse='.(int) $ellipsis->inVendor;
- $ellipsisTail = isset($ellipsis->attr['ellipsis-tail']) ? $ellipsis->attr['ellipsis-tail'] : 0;
- $ellipsis = isset($ellipsis->attr['ellipsis']) ? $ellipsis->attr['ellipsis'] : 0;
+ if (!empty($f['class']) && is_subclass_of($f['class'], 'Twig_Template') && method_exists($f['class'], 'getDebugInfo')) {
+ $template = isset($f['object']) ? $f['object'] : new $f['class'](new \Twig_Environment(new \Twig_Loader_Filesystem()));
- if (file_exists($f['file']) && 0 <= self::$srcContext) {
- if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
- $template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));
-
- $ellipsis = 0;
- $templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
+ try {
+ $templateName = $template->getTemplateName();
+ $templateSrc = explode("\n", method_exists($template, 'getSource') ? $template->getSource() : $template->getEnvironment()->getLoader()->getSource($templateName));
$templateInfo = $template->getDebugInfo();
if (isset($templateInfo[$f['line']])) {
- if (!method_exists($template, 'getSourceContext') || !file_exists($templatePath = $template->getSourceContext()->getPath())) {
- $templatePath = null;
- }
- if ($templateSrc) {
- $src = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext, 'twig', $templatePath, $f);
- $srcKey = ($templatePath ?: $template->getTemplateName()).':'.$templateInfo[$f['line']];
- }
+ $src[$templateName.':'.$templateInfo[$f['line']]] = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext);
}
+ } catch (\Twig_Error_Loader $e) {
}
- if ($srcKey == $f['file']) {
- $src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, 'php', $f['file'], $f);
- $srcKey .= ':'.$f['line'];
- if ($ellipsis) {
- $ellipsis += 1 + \strlen($f['line']);
- }
- }
- $srcAttr .= sprintf('&separator= &file=%s&line=%d', rawurlencode($f['file']), $f['line']);
- } else {
- $srcAttr .= '&separator=:';
}
- $srcAttr .= $ellipsis ? '&ellipsis-type=path&ellipsis='.$ellipsis.'&ellipsis-tail='.$ellipsisTail : '';
- self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(["\0~$srcAttr\0$srcKey" => $src]);
+ } else {
+ $src[$f['file']] = $f['line'];
}
+ $a[$prefix.'src'] = new EnumStub($src);
}
unset($a[$prefix.'args'], $a[$prefix.'line'], $a[$prefix.'file']);
@@ -254,129 +176,63 @@ class ExceptionCaster
unset($a[$k]);
}
}
- if ($frame->keepArgs && !empty($f['args'])) {
- $a[$prefix.'arguments'] = new ArgsStub($f['args'], $f['function'], $f['class']);
+ if ($frame->keepArgs && isset($f['args'])) {
+ $a[$prefix.'args'] = $f['args'];
}
return $a;
}
- private static function filterExceptionArray(string $xClass, array $a, string $xPrefix, int $filter): array
+ private static function filterExceptionArray($xClass, array $a, $xPrefix, $filter)
{
if (isset($a[$xPrefix.'trace'])) {
$trace = $a[$xPrefix.'trace'];
unset($a[$xPrefix.'trace']); // Ensures the trace is always last
} else {
- $trace = [];
+ $trace = array();
}
- if (!($filter & Caster::EXCLUDE_VERBOSE) && $trace) {
- if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
- self::traceUnshift($trace, $xClass, $a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
- }
- $a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);
+ if (!($filter & Caster::EXCLUDE_VERBOSE)) {
+ array_unshift($trace, array(
+ 'function' => $xClass ? 'new '.$xClass : null,
+ 'file' => $a[Caster::PREFIX_PROTECTED.'file'],
+ 'line' => $a[Caster::PREFIX_PROTECTED.'line'],
+ ));
+ $a[$xPrefix.'trace'] = new TraceStub($trace);
}
if (empty($a[$xPrefix.'previous'])) {
unset($a[$xPrefix.'previous']);
}
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);
- if (isset($a[Caster::PREFIX_PROTECTED.'message']) && false !== strpos($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) {
- $a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
- return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
- }, $a[Caster::PREFIX_PROTECTED.'message']);
- }
-
- if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
- $a[Caster::PREFIX_PROTECTED.'file'] = new LinkStub($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
- }
-
return $a;
}
- private static function traceUnshift(array &$trace, ?string $class, string $file, int $line): void
+ private static function extractSource(array $srcArray, $line, $srcContext)
{
- if (isset($trace[0]['file'], $trace[0]['line']) && $trace[0]['file'] === $file && $trace[0]['line'] === $line) {
- return;
- }
- array_unshift($trace, [
- 'function' => $class ? 'new '.$class : null,
- 'file' => $file,
- 'line' => $line,
- ]);
- }
-
- private static function extractSource(string $srcLines, int $line, int $srcContext, string $lang, ?string $file, array $frame): EnumStub
- {
- $srcLines = explode("\n", $srcLines);
- $src = [];
+ $src = array();
for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
- $src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
- }
-
- if ($frame['function'] ?? false) {
- $stub = new CutStub(new \stdClass());
- $stub->class = (isset($frame['class']) ? $frame['class'].$frame['type'] : '').$frame['function'];
- $stub->type = Stub::TYPE_OBJECT;
- $stub->attr['cut_hash'] = true;
- $stub->attr['file'] = $frame['file'];
- $stub->attr['line'] = $frame['line'];
-
- try {
- $caller = isset($frame['class']) ? new \ReflectionMethod($frame['class'], $frame['function']) : new \ReflectionFunction($frame['function']);
- $stub->class .= ReflectionCaster::getSignature(ReflectionCaster::castFunctionAbstract($caller, [], $stub, true, Caster::EXCLUDE_VERBOSE));
-
- if ($f = $caller->getFileName()) {
- $stub->attr['file'] = $f;
- $stub->attr['line'] = $caller->getStartLine();
- }
- } catch (\ReflectionException $e) {
- // ignore fake class/function
- }
-
- $srcLines = ["\0~separator=\0" => $stub];
- } else {
- $stub = null;
- $srcLines = [];
+ $src[] = (isset($srcArray[$i]) ? $srcArray[$i] : '')."\n";
}
$ltrim = 0;
- do {
- $pad = null;
- for ($i = $srcContext << 1; $i >= 0; --$i) {
- if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) {
- if (null === $pad) {
- $pad = $c;
- }
- if ((' ' !== $c && "\t" !== $c) || $pad !== $c) {
- break;
- }
- }
+ while (' ' === $src[0][$ltrim] || "\t" === $src[0][$ltrim]) {
+ $i = $srcContext << 1;
+ while ($i > 0 && $src[0][$ltrim] === $src[$i][$ltrim]) {
+ --$i;
+ }
+ if ($i) {
+ break;
}
++$ltrim;
- } while (0 > $i && null !== $pad);
-
- --$ltrim;
-
- foreach ($src as $i => $c) {
- if ($ltrim) {
- $c = isset($c[$ltrim]) && "\r" !== $c[$ltrim] ? substr($c, $ltrim) : ltrim($c, " \t");
+ }
+ if ($ltrim) {
+ foreach ($src as $i => $line) {
+ $src[$i] = substr($line, $ltrim);
}
- $c = substr($c, 0, -1);
- if ($i !== $srcContext) {
- $c = new ConstStub('default', $c);
- } else {
- $c = new ConstStub($c, $stub ? 'in '.$stub->class : '');
- if (null !== $file) {
- $c->attr['file'] = $file;
- $c->attr['line'] = $line;
- }
- }
- $c->attr['lang'] = $lang;
- $srcLines[sprintf("\0~separator=› &%d\0", $i + $line - $srcContext)] = $c;
}
- return new EnumStub($srcLines);
+ return implode('', $src);
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/FrameStub.php b/htdocs/includes/symfony/var-dumper/Caster/FrameStub.php
index 878675528f7..1e1194dc85b 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/FrameStub.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/FrameStub.php
@@ -21,7 +21,7 @@ class FrameStub extends EnumStub
public $keepArgs;
public $inTraceStub;
- public function __construct(array $frame, bool $keepArgs = true, bool $inTraceStub = false)
+ public function __construct(array $frame, $keepArgs = true, $inTraceStub = false)
{
$this->value = $frame;
$this->keepArgs = $keepArgs;
diff --git a/htdocs/includes/symfony/var-dumper/Caster/GmpCaster.php b/htdocs/includes/symfony/var-dumper/Caster/GmpCaster.php
deleted file mode 100644
index 2b20e15dc80..00000000000
--- a/htdocs/includes/symfony/var-dumper/Caster/GmpCaster.php
+++ /dev/null
@@ -1,32 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Caster;
-
-use Symfony\Component\VarDumper\Cloner\Stub;
-
-/**
- * Casts GMP objects to array representation.
- *
- * @author Hamza Amrouche
- *
- * @final since Symfony 4.4
- */
-class GmpCaster
-{
- public static function castGmp(\GMP $gmp, array $a, Stub $stub, $isNested, $filter): array
- {
- $a[Caster::PREFIX_VIRTUAL.'value'] = new ConstStub(gmp_strval($gmp), gmp_strval($gmp));
-
- return $a;
- }
-}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ImagineCaster.php b/htdocs/includes/symfony/var-dumper/Caster/ImagineCaster.php
deleted file mode 100644
index d1289da3370..00000000000
--- a/htdocs/includes/symfony/var-dumper/Caster/ImagineCaster.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Caster;
-
-use Imagine\Image\ImageInterface;
-use Symfony\Component\VarDumper\Cloner\Stub;
-
-/**
- * @author Grégoire Pineau
- * @author Jan Schädlich
- */
-class LinkStub extends ConstStub
-{
- public $inVendor = false;
-
- private static $vendorRoots;
- private static $composerRoots;
-
- public function __construct($label, int $line = 0, $href = null)
- {
- $this->value = $label;
-
- if (null === $href) {
- $href = $label;
- }
- if (!\is_string($href)) {
- return;
- }
- if (0 === strpos($href, 'file://')) {
- if ($href === $label) {
- $label = substr($label, 7);
- }
- $href = substr($href, 7);
- } elseif (false !== strpos($href, '://')) {
- $this->attr['href'] = $href;
-
- return;
- }
- if (!file_exists($href)) {
- return;
- }
- if ($line) {
- $this->attr['line'] = $line;
- }
- if ($label !== $this->attr['file'] = realpath($href) ?: $href) {
- return;
- }
- if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) {
- $this->attr['ellipsis'] = \strlen($href) - \strlen($composerRoot) + 1;
- $this->attr['ellipsis-type'] = 'path';
- $this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode('', \array_slice(explode(\DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
- } elseif (3 < \count($ellipsis = explode(\DIRECTORY_SEPARATOR, $href))) {
- $this->attr['ellipsis'] = 2 + \strlen(implode('', \array_slice($ellipsis, -2)));
- $this->attr['ellipsis-type'] = 'path';
- $this->attr['ellipsis-tail'] = 1;
- }
- }
-
- private function getComposerRoot(string $file, bool &$inVendor)
- {
- if (null === self::$vendorRoots) {
- self::$vendorRoots = [];
-
- foreach (get_declared_classes() as $class) {
- if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
- $r = new \ReflectionClass($class);
- $v = \dirname($r->getFileName(), 2);
- if (file_exists($v.'/composer/installed.json')) {
- self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
- }
- }
- }
- }
- $inVendor = false;
-
- if (isset(self::$composerRoots[$dir = \dirname($file)])) {
- return self::$composerRoots[$dir];
- }
-
- foreach (self::$vendorRoots as $root) {
- if ($inVendor = 0 === strpos($file, $root)) {
- return $root;
- }
- }
-
- $parent = $dir;
- while (!@file_exists($parent.'/composer.json')) {
- if (!@file_exists($parent)) {
- // open_basedir restriction in effect
- break;
- }
- if ($parent === \dirname($parent)) {
- return self::$composerRoots[$dir] = false;
- }
-
- $parent = \dirname($parent);
- }
-
- return self::$composerRoots[$dir] = $parent.\DIRECTORY_SEPARATOR;
- }
-}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/MemcachedCaster.php b/htdocs/includes/symfony/var-dumper/Caster/MemcachedCaster.php
deleted file mode 100644
index 942eecb11fb..00000000000
--- a/htdocs/includes/symfony/var-dumper/Caster/MemcachedCaster.php
+++ /dev/null
@@ -1,81 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Caster;
-
-use Symfony\Component\VarDumper\Cloner\Stub;
-
-/**
- * @author Jan Schädlich
+ * Casts classes from the MongoDb extension to array representation.
*
- * @final since Symfony 4.4
+ * @author Nicolas Grekas
*/
-class ProxyManagerCaster
+class MongoCaster
{
- public static function castProxy(ProxyInterface $c, array $a, Stub $stub, $isNested)
+ public static function castCursor(\MongoCursorInterface $cursor, array $a, Stub $stub, $isNested)
{
- if ($parent = get_parent_class($c)) {
- $stub->class .= ' - '.$parent;
+ if ($info = $cursor->info()) {
+ foreach ($info as $k => $v) {
+ $a[Caster::PREFIX_VIRTUAL.$k] = $v;
+ }
}
- $stub->class .= '@proxy';
+ $a[Caster::PREFIX_VIRTUAL.'dead'] = $cursor->dead();
return $a;
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/PdoCaster.php b/htdocs/includes/symfony/var-dumper/Caster/PdoCaster.php
index d30ab014699..e60b9275fd8 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/PdoCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/PdoCaster.php
@@ -17,81 +17,73 @@ use Symfony\Component\VarDumper\Cloner\Stub;
* Casts PDO related classes to array representation.
*
* @author Nicolas Grekas
- *
- * @final since Symfony 4.4
*/
class PdoCaster
{
- private static $pdoAttributes = [
- 'CASE' => [
+ private static $pdoAttributes = array(
+ 'CASE' => array(
\PDO::CASE_LOWER => 'LOWER',
\PDO::CASE_NATURAL => 'NATURAL',
\PDO::CASE_UPPER => 'UPPER',
- ],
- 'ERRMODE' => [
+ ),
+ 'ERRMODE' => array(
\PDO::ERRMODE_SILENT => 'SILENT',
\PDO::ERRMODE_WARNING => 'WARNING',
\PDO::ERRMODE_EXCEPTION => 'EXCEPTION',
- ],
+ ),
'TIMEOUT',
'PREFETCH',
'AUTOCOMMIT',
'PERSISTENT',
'DRIVER_NAME',
'SERVER_INFO',
- 'ORACLE_NULLS' => [
+ 'ORACLE_NULLS' => array(
\PDO::NULL_NATURAL => 'NATURAL',
\PDO::NULL_EMPTY_STRING => 'EMPTY_STRING',
\PDO::NULL_TO_STRING => 'TO_STRING',
- ],
+ ),
'CLIENT_VERSION',
'SERVER_VERSION',
'STATEMENT_CLASS',
'EMULATE_PREPARES',
'CONNECTION_STATUS',
'STRINGIFY_FETCHES',
- 'DEFAULT_FETCH_MODE' => [
+ 'DEFAULT_FETCH_MODE' => array(
\PDO::FETCH_ASSOC => 'ASSOC',
\PDO::FETCH_BOTH => 'BOTH',
\PDO::FETCH_LAZY => 'LAZY',
\PDO::FETCH_NUM => 'NUM',
\PDO::FETCH_OBJ => 'OBJ',
- ],
- ];
+ ),
+ );
public static function castPdo(\PDO $c, array $a, Stub $stub, $isNested)
{
- $attr = [];
+ $attr = array();
$errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
$c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
foreach (self::$pdoAttributes as $k => $v) {
if (!isset($k[0])) {
$k = $v;
- $v = [];
+ $v = array();
}
try {
- $attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(\constant('PDO::ATTR_'.$k));
+ $attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(constant('PDO::ATTR_'.$k));
if ($v && isset($v[$attr[$k]])) {
$attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
}
} catch (\Exception $e) {
}
}
- if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
- if ($attr[$k][1]) {
- $attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]);
- }
- $attr[$k][0] = new ClassStub($attr[$k][0]);
- }
$prefix = Caster::PREFIX_VIRTUAL;
- $a += [
+ $a += array(
$prefix.'inTransaction' => method_exists($c, 'inTransaction'),
$prefix.'errorInfo' => $c->errorInfo(),
$prefix.'attributes' => new EnumStub($attr),
- ];
+ );
if ($a[$prefix.'inTransaction']) {
$a[$prefix.'inTransaction'] = $c->inTransaction();
diff --git a/htdocs/includes/symfony/var-dumper/Caster/PgSqlCaster.php b/htdocs/includes/symfony/var-dumper/Caster/PgSqlCaster.php
index c54fb428645..88414e4ccff 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/PgSqlCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/PgSqlCaster.php
@@ -17,12 +17,10 @@ use Symfony\Component\VarDumper\Cloner\Stub;
* Casts pqsql resources to array representation.
*
* @author Nicolas Grekas
- *
- * @final since Symfony 4.4
*/
class PgSqlCaster
{
- private static $paramCodes = [
+ private static $paramCodes = array(
'server_encoding',
'client_encoding',
'is_superuser',
@@ -33,17 +31,17 @@ class PgSqlCaster
'integer_datetimes',
'application_name',
'standard_conforming_strings',
- ];
+ );
- private static $transactionStatus = [
+ private static $transactionStatus = array(
PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
- ];
+ );
- private static $resultStatus = [
+ private static $resultStatus = array(
PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
@@ -52,9 +50,9 @@ class PgSqlCaster
PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
- ];
+ );
- private static $diagCodes = [
+ private static $diagCodes = array(
'severity' => PGSQL_DIAG_SEVERITY,
'sqlstate' => PGSQL_DIAG_SQLSTATE,
'message' => PGSQL_DIAG_MESSAGE_PRIMARY,
@@ -67,7 +65,7 @@ class PgSqlCaster
'file' => PGSQL_DIAG_SOURCE_FILE,
'line' => PGSQL_DIAG_SOURCE_LINE,
'function' => PGSQL_DIAG_SOURCE_FUNCTION,
- ];
+ );
public static function castLargeObject($lo, array $a, Stub $stub, $isNested)
{
@@ -129,14 +127,14 @@ class PgSqlCaster
$fields = pg_num_fields($result);
for ($i = 0; $i < $fields; ++$i) {
- $field = [
+ $field = array(
'name' => pg_field_name($result, $i),
'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
'nullable' => (bool) pg_field_is_null($result, $i),
'storage' => pg_field_size($result, $i).' bytes',
'display' => pg_field_prtlen($result, $i).' chars',
- ];
+ );
if (' (OID: )' === $field['table']) {
$field['table'] = null;
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/RedisCaster.php b/htdocs/includes/symfony/var-dumper/Caster/RedisCaster.php
deleted file mode 100644
index e92c65baebe..00000000000
--- a/htdocs/includes/symfony/var-dumper/Caster/RedisCaster.php
+++ /dev/null
@@ -1,152 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Caster;
-
-use Symfony\Component\VarDumper\Cloner\Stub;
-
-/**
- * Casts Redis class from ext-redis to array representation.
- *
- * @author Nicolas Grekas
- *
- * @final since Symfony 4.4
- */
-class RedisCaster
-{
- private static $serializer = [
- \Redis::SERIALIZER_NONE => 'NONE',
- \Redis::SERIALIZER_PHP => 'PHP',
- 2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY
- ];
-
- private static $mode = [
- \Redis::ATOMIC => 'ATOMIC',
- \Redis::MULTI => 'MULTI',
- \Redis::PIPELINE => 'PIPELINE',
- ];
-
- private static $compression = [
- 0 => 'NONE', // Redis::COMPRESSION_NONE
- 1 => 'LZF', // Redis::COMPRESSION_LZF
- ];
-
- private static $failover = [
- \RedisCluster::FAILOVER_NONE => 'NONE',
- \RedisCluster::FAILOVER_ERROR => 'ERROR',
- \RedisCluster::FAILOVER_DISTRIBUTE => 'DISTRIBUTE',
- \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES',
- ];
-
- public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested)
- {
- $prefix = Caster::PREFIX_VIRTUAL;
-
- if (!$connected = $c->isConnected()) {
- return $a + [
- $prefix.'isConnected' => $connected,
- ];
- }
-
- $mode = $c->getMode();
-
- return $a + [
- $prefix.'isConnected' => $connected,
- $prefix.'host' => $c->getHost(),
- $prefix.'port' => $c->getPort(),
- $prefix.'auth' => $c->getAuth(),
- $prefix.'mode' => isset(self::$mode[$mode]) ? new ConstStub(self::$mode[$mode], $mode) : $mode,
- $prefix.'dbNum' => $c->getDbNum(),
- $prefix.'timeout' => $c->getTimeout(),
- $prefix.'lastError' => $c->getLastError(),
- $prefix.'persistentId' => $c->getPersistentID(),
- $prefix.'options' => self::getRedisOptions($c),
- ];
- }
-
- public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested)
- {
- $prefix = Caster::PREFIX_VIRTUAL;
-
- return $a + [
- $prefix.'hosts' => $c->_hosts(),
- $prefix.'function' => ClassStub::wrapCallable($c->_function()),
- $prefix.'lastError' => $c->getLastError(),
- $prefix.'options' => self::getRedisOptions($c),
- ];
- }
-
- public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, $isNested)
- {
- $prefix = Caster::PREFIX_VIRTUAL;
- $failover = $c->getOption(\RedisCluster::OPT_SLAVE_FAILOVER);
-
- $a += [
- $prefix.'_masters' => $c->_masters(),
- $prefix.'_redir' => $c->_redir(),
- $prefix.'mode' => new ConstStub($c->getMode() ? 'MULTI' : 'ATOMIC', $c->getMode()),
- $prefix.'lastError' => $c->getLastError(),
- $prefix.'options' => self::getRedisOptions($c, [
- 'SLAVE_FAILOVER' => isset(self::$failover[$failover]) ? new ConstStub(self::$failover[$failover], $failover) : $failover,
- ]),
- ];
-
- return $a;
- }
-
- /**
- * @param \Redis|\RedisArray|\RedisCluster $redis
- */
- private static function getRedisOptions($redis, array $options = []): EnumStub
- {
- $serializer = $redis->getOption(\Redis::OPT_SERIALIZER);
- if (\is_array($serializer)) {
- foreach ($serializer as &$v) {
- if (isset(self::$serializer[$v])) {
- $v = new ConstStub(self::$serializer[$v], $v);
- }
- }
- } elseif (isset(self::$serializer[$serializer])) {
- $serializer = new ConstStub(self::$serializer[$serializer], $serializer);
- }
-
- $compression = \defined('Redis::OPT_COMPRESSION') ? $redis->getOption(\Redis::OPT_COMPRESSION) : 0;
- if (\is_array($compression)) {
- foreach ($compression as &$v) {
- if (isset(self::$compression[$v])) {
- $v = new ConstStub(self::$compression[$v], $v);
- }
- }
- } elseif (isset(self::$compression[$compression])) {
- $compression = new ConstStub(self::$compression[$compression], $compression);
- }
-
- $retry = \defined('Redis::OPT_SCAN') ? $redis->getOption(\Redis::OPT_SCAN) : 0;
- if (\is_array($retry)) {
- foreach ($retry as &$v) {
- $v = new ConstStub($v ? 'RETRY' : 'NORETRY', $v);
- }
- } else {
- $retry = new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry);
- }
-
- $options += [
- 'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : 0,
- 'READ_TIMEOUT' => $redis->getOption(\Redis::OPT_READ_TIMEOUT),
- 'COMPRESSION' => $compression,
- 'SERIALIZER' => $serializer,
- 'PREFIX' => $redis->getOption(\Redis::OPT_PREFIX),
- 'SCAN' => $retry,
- ];
-
- return new EnumStub($options);
- }
-}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ReflectionCaster.php b/htdocs/includes/symfony/var-dumper/Caster/ReflectionCaster.php
index 81a2da7298c..936e11982ee 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/ReflectionCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/ReflectionCaster.php
@@ -17,14 +17,10 @@ use Symfony\Component\VarDumper\Cloner\Stub;
* Casts Reflector related classes to array representation.
*
* @author Nicolas Grekas
- *
- * @final since Symfony 4.4
*/
class ReflectionCaster
{
- const UNSET_CLOSURE_FILE_INFO = ['Closure' => __CLASS__.'::unsetClosureFileInfo'];
-
- private static $extraMap = [
+ private static $extraMap = array(
'docComment' => 'getDocComment',
'extension' => 'getExtensionName',
'isDisabled' => 'isDisabled',
@@ -33,74 +29,54 @@ class ReflectionCaster
'isUserDefined' => 'isUserDefined',
'isGenerator' => 'isGenerator',
'isVariadic' => 'isVariadic',
- ];
+ );
- public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested, $filter = 0)
+ public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$c = new \ReflectionFunction($c);
- $a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter);
+ $stub->class = 'Closure'; // HHVM generates unique class names for closures
+ $a = static::castFunctionAbstract($c, $a, $stub, $isNested);
- if (false === strpos($c->name, '{closure}')) {
- $stub->class = isset($a[$prefix.'class']) ? $a[$prefix.'class']->value.'::'.$c->name : $c->name;
- unset($a[$prefix.'class']);
+ if (isset($a[$prefix.'parameters'])) {
+ foreach ($a[$prefix.'parameters']->value as &$v) {
+ $param = $v;
+ $v = new EnumStub(array());
+ foreach (static::castParameter($param, array(), $stub, true) as $k => $param) {
+ if ("\0" === $k[0]) {
+ $v->value[substr($k, 3)] = $param;
+ }
+ }
+ unset($v->value['position'], $v->value['isVariadic'], $v->value['byReference'], $v);
+ }
}
- unset($a[$prefix.'extra']);
-
- $stub->class .= self::getSignature($a);
if ($f = $c->getFileName()) {
- $stub->attr['file'] = $f;
- $stub->attr['line'] = $c->getStartLine();
- }
-
- unset($a[$prefix.'parameters']);
-
- if ($filter & Caster::EXCLUDE_VERBOSE) {
- $stub->cut += ($c->getFileName() ? 2 : 0) + \count($a);
-
- return [];
- }
-
- if ($f) {
- $a[$prefix.'file'] = new LinkStub($f, $c->getStartLine());
+ $a[$prefix.'file'] = $f;
$a[$prefix.'line'] = $c->getStartLine().' to '.$c->getEndLine();
}
- return $a;
- }
-
- public static function unsetClosureFileInfo(\Closure $c, array $a)
- {
- unset($a[Caster::PREFIX_VIRTUAL.'file'], $a[Caster::PREFIX_VIRTUAL.'line']);
+ $prefix = Caster::PREFIX_DYNAMIC;
+ unset($a['name'], $a[$prefix.'0'], $a[$prefix.'this'], $a[$prefix.'parameter'], $a[Caster::PREFIX_VIRTUAL.'extra']);
return $a;
}
public static function castGenerator(\Generator $c, array $a, Stub $stub, $isNested)
{
- // Cannot create ReflectionGenerator based on a terminated Generator
- try {
- $reflectionGenerator = new \ReflectionGenerator($c);
- } catch (\Exception $e) {
- $a[Caster::PREFIX_VIRTUAL.'closed'] = true;
-
- return $a;
- }
-
- return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested);
+ return class_exists('ReflectionGenerator', false) ? self::castReflectionGenerator(new \ReflectionGenerator($c), $a, $stub, $isNested) : $a;
}
public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
- $a += [
- $prefix.'name' => $c instanceof \ReflectionNamedType ? $c->getName() : (string) $c,
+ $a += array(
+ $prefix.'type' => $c->__toString(),
$prefix.'allowsNull' => $c->allowsNull(),
$prefix.'isBuiltin' => $c->isBuiltin(),
- ];
+ );
return $a;
}
@@ -112,31 +88,31 @@ class ReflectionCaster
if ($c->getThis()) {
$a[$prefix.'this'] = new CutStub($c->getThis());
}
- $function = $c->getFunction();
- $frame = [
- 'class' => isset($function->class) ? $function->class : null,
- 'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null,
- 'function' => $function->name,
+ $x = $c->getFunction();
+ $frame = array(
+ 'class' => isset($x->class) ? $x->class : null,
+ 'type' => isset($x->class) ? ($x->isStatic() ? '::' : '->') : null,
+ 'function' => $x->name,
'file' => $c->getExecutingFile(),
'line' => $c->getExecutingLine(),
- ];
+ );
if ($trace = $c->getTrace(DEBUG_BACKTRACE_IGNORE_ARGS)) {
- $function = new \ReflectionGenerator($c->getExecutingGenerator());
- array_unshift($trace, [
+ $x = new \ReflectionGenerator($c->getExecutingGenerator());
+ array_unshift($trace, array(
'function' => 'yield',
- 'file' => $function->getExecutingFile(),
- 'line' => $function->getExecutingLine() - 1,
- ]);
+ 'file' => $x->getExecutingFile(),
+ 'line' => $x->getExecutingLine() - 1,
+ ));
$trace[] = $frame;
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
} else {
- $function = new FrameStub($frame, false, true);
- $function = ExceptionCaster::castFrameStub($function, [], $function, true);
- $a[$prefix.'executing'] = $function[$prefix.'src'];
+ $x = new FrameStub($frame, false, true);
+ $x = ExceptionCaster::castFrameStub($x, array(), $x, true);
+ $a[$prefix.'executing'] = new EnumStub(array(
+ $frame['class'].$frame['type'].$frame['function'].'()' => $x[$prefix.'src'],
+ ));
}
- $a[Caster::PREFIX_VIRTUAL.'closed'] = false;
-
return $a;
}
@@ -148,11 +124,11 @@ class ReflectionCaster
$a[$prefix.'modifiers'] = implode(' ', $n);
}
- self::addMap($a, $c, [
+ self::addMap($a, $c, array(
'extends' => 'getParentClass',
'implements' => 'getInterfaceNames',
'constants' => 'getConstants',
- ]);
+ ));
foreach ($c->getProperties() as $n) {
$a[$prefix.'properties'][$n->name] = $n;
@@ -173,20 +149,15 @@ class ReflectionCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
- self::addMap($a, $c, [
+ self::addMap($a, $c, array(
'returnsReference' => 'returnsReference',
'returnType' => 'getReturnType',
'class' => 'getClosureScopeClass',
'this' => 'getClosureThis',
- ]);
+ ));
if (isset($a[$prefix.'returnType'])) {
- $v = $a[$prefix.'returnType'];
- $v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
- $a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
- }
- if (isset($a[$prefix.'class'])) {
- $a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
+ $a[$prefix.'returnType'] = (string) $a[$prefix.'returnType'];
}
if (isset($a[$prefix.'this'])) {
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
@@ -194,25 +165,21 @@ class ReflectionCaster
foreach ($c->getParameters() as $v) {
$k = '$'.$v->name;
- if ($v->isVariadic()) {
- $k = '...'.$k;
- }
if ($v->isPassedByReference()) {
$k = '&'.$k;
}
+ if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
+ $k = '...'.$k;
+ }
$a[$prefix.'parameters'][$k] = $v;
}
if (isset($a[$prefix.'parameters'])) {
$a[$prefix.'parameters'] = new EnumStub($a[$prefix.'parameters']);
}
- if (!($filter & Caster::EXCLUDE_VERBOSE) && $v = $c->getStaticVariables()) {
+ if ($v = $c->getStaticVariables()) {
foreach ($v as $k => &$v) {
- if (\is_object($v)) {
- $a[$prefix.'use']['$'.$k] = new CutStub($v);
- } else {
- $a[$prefix.'use']['$'.$k] = &$v;
- }
+ $a[$prefix.'use']['$'.$k] = &$v;
}
unset($v);
$a[$prefix.'use'] = new EnumStub($a[$prefix.'use']);
@@ -222,6 +189,9 @@ class ReflectionCaster
self::addExtra($a, $c);
}
+ // Added by HHVM
+ unset($a[Caster::PREFIX_DYNAMIC.'static']);
+
return $a;
}
@@ -236,33 +206,42 @@ class ReflectionCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
- self::addMap($a, $c, [
+ // Added by HHVM
+ unset($a['info']);
+
+ self::addMap($a, $c, array(
'position' => 'getPosition',
'isVariadic' => 'isVariadic',
'byReference' => 'isPassedByReference',
- 'allowsNull' => 'allowsNull',
- ]);
+ ));
- if ($v = $c->getType()) {
- $a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v;
- }
-
- if (isset($a[$prefix.'typeHint'])) {
- $v = $a[$prefix.'typeHint'];
- $a[$prefix.'typeHint'] = new ClassStub($v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
- } else {
- unset($a[$prefix.'allowsNull']);
+ try {
+ if (method_exists($c, 'hasType')) {
+ if ($c->hasType()) {
+ $a[$prefix.'typeHint'] = $c->getType()->__toString();
+ }
+ } elseif ($c->isArray()) {
+ $a[$prefix.'typeHint'] = 'array';
+ } elseif (method_exists($c, 'isCallable') && $c->isCallable()) {
+ $a[$prefix.'typeHint'] = 'callable';
+ } elseif ($v = $c->getClass()) {
+ $a[$prefix.'typeHint'] = $v->name;
+ }
+ } catch (\ReflectionException $e) {
+ if (preg_match('/^Class ([^ ]++) does not exist$/', $e->getMessage(), $m)) {
+ $a[$prefix.'typeHint'] = $m[1];
+ }
}
try {
$a[$prefix.'default'] = $v = $c->getDefaultValue();
- if ($c->isDefaultValueConstant()) {
+ if (method_exists($c, 'isDefaultValueConstant') && $c->isDefaultValueConstant()) {
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
}
- if (null === $v) {
- unset($a[$prefix.'allowsNull']);
- }
} catch (\ReflectionException $e) {
+ if (isset($a[$prefix.'typeHint']) && $c->allowsNull()) {
+ $a[$prefix.'default'] = null;
+ }
}
return $a;
@@ -276,16 +255,9 @@ class ReflectionCaster
return $a;
}
- public static function castReference(\ReflectionReference $c, array $a, Stub $stub, $isNested)
- {
- $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId();
-
- return $a;
- }
-
public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, $isNested)
{
- self::addMap($a, $c, [
+ self::addMap($a, $c, array(
'version' => 'getVersion',
'dependencies' => 'getDependencies',
'iniEntries' => 'getIniEntries',
@@ -294,79 +266,29 @@ class ReflectionCaster
'constants' => 'getConstants',
'functions' => 'getFunctions',
'classes' => 'getClasses',
- ]);
+ ));
return $a;
}
public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, $isNested)
{
- self::addMap($a, $c, [
+ self::addMap($a, $c, array(
'version' => 'getVersion',
'author' => 'getAuthor',
'copyright' => 'getCopyright',
'url' => 'getURL',
- ]);
+ ));
return $a;
}
- public static function getSignature(array $a)
+ private static function addExtra(&$a, \Reflector $c)
{
- $prefix = Caster::PREFIX_VIRTUAL;
- $signature = '';
-
- if (isset($a[$prefix.'parameters'])) {
- foreach ($a[$prefix.'parameters']->value as $k => $param) {
- $signature .= ', ';
- if ($type = $param->getType()) {
- if (!$type instanceof \ReflectionNamedType) {
- $signature .= $type.' ';
- } else {
- if (!$param->isOptional() && $param->allowsNull()) {
- $signature .= '?';
- }
- $signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';
- }
- }
- $signature .= $k;
-
- if (!$param->isDefaultValueAvailable()) {
- continue;
- }
- $v = $param->getDefaultValue();
- $signature .= ' = ';
-
- if ($param->isDefaultValueConstant()) {
- $signature .= substr(strrchr('\\'.$param->getDefaultValueConstantName(), '\\'), 1);
- } elseif (null === $v) {
- $signature .= 'null';
- } elseif (\is_array($v)) {
- $signature .= $v ? '[…'.\count($v).']' : '[]';
- } elseif (\is_string($v)) {
- $signature .= 10 > \strlen($v) && false === strpos($v, '\\') ? "'{$v}'" : "'…".\strlen($v)."'";
- } elseif (\is_bool($v)) {
- $signature .= $v ? 'true' : 'false';
- } else {
- $signature .= $v;
- }
- }
- }
- $signature = (empty($a[$prefix.'returnsReference']) ? '' : '&').'('.substr($signature, 2).')';
-
- if (isset($a[$prefix.'returnType'])) {
- $signature .= ': '.substr(strrchr('\\'.$a[$prefix.'returnType'], '\\'), 1);
- }
-
- return $signature;
- }
-
- private static function addExtra(array &$a, \Reflector $c)
- {
- $x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : [];
+ $x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : array();
if (method_exists($c, 'getFileName') && $m = $c->getFileName()) {
- $x['file'] = new LinkStub($m, $c->getStartLine());
+ $x['file'] = $m;
$x['line'] = $c->getStartLine().' to '.$c->getEndLine();
}
@@ -377,13 +299,9 @@ class ReflectionCaster
}
}
- private static function addMap(array &$a, \Reflector $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL)
+ private static function addMap(&$a, \Reflector $c, $map, $prefix = Caster::PREFIX_VIRTUAL)
{
foreach ($map as $k => $m) {
- if (\PHP_VERSION_ID >= 80000 && 'isDisabled' === $k) {
- continue;
- }
-
if (method_exists($c, $m) && false !== ($m = $c->$m()) && null !== $m) {
$a[$prefix.$k] = $m instanceof \Reflector ? $m->name : $m;
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/ResourceCaster.php b/htdocs/includes/symfony/var-dumper/Caster/ResourceCaster.php
index 5a7c4285252..903641f69c6 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/ResourceCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/ResourceCaster.php
@@ -17,16 +17,9 @@ use Symfony\Component\VarDumper\Cloner\Stub;
* Casts common resource types to array representation.
*
* @author Nicolas Grekas
- *
- * @final since Symfony 4.4
*/
class ResourceCaster
{
- /**
- * @param \CurlHandle|resource $h
- *
- * @return array
- */
public static function castCurl($h, array $a, Stub $stub, $isNested)
{
return curl_getinfo($h);
@@ -47,17 +40,12 @@ class ResourceCaster
public static function castStream($stream, array $a, Stub $stub, $isNested)
{
- $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
- if (isset($a['uri'])) {
- $a['uri'] = new LinkStub($a['uri']);
- }
-
- return $a;
+ return stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
}
public static function castStreamContext($stream, array $a, Stub $stub, $isNested)
{
- return @stream_context_get_params($stream) ?: $a;
+ return stream_context_get_params($stream);
}
public static function castGd($gd, array $a, Stub $stub, $isNested)
@@ -76,30 +64,4 @@ class ResourceCaster
return $a;
}
-
- public static function castOpensslX509($h, array $a, Stub $stub, $isNested)
- {
- $stub->cut = -1;
- $info = openssl_x509_parse($h, false);
-
- $pin = openssl_pkey_get_public($h);
- $pin = openssl_pkey_get_details($pin)['key'];
- $pin = \array_slice(explode("\n", $pin), 1, -2);
- $pin = base64_decode(implode('', $pin));
- $pin = base64_encode(hash('sha256', $pin, true));
-
- $a += [
- 'subject' => new EnumStub(array_intersect_key($info['subject'], ['organizationName' => true, 'commonName' => true])),
- 'issuer' => new EnumStub(array_intersect_key($info['issuer'], ['organizationName' => true, 'commonName' => true])),
- 'expiry' => new ConstStub(date(\DateTime::ISO8601, $info['validTo_time_t']), $info['validTo_time_t']),
- 'fingerprint' => new EnumStub([
- 'md5' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'md5')), 2, ':', true)),
- 'sha1' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha1')), 2, ':', true)),
- 'sha256' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha256')), 2, ':', true)),
- 'pin-sha256' => new ConstStub($pin),
- ]),
- ];
-
- return $a;
- }
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/SplCaster.php b/htdocs/includes/symfony/var-dumper/Caster/SplCaster.php
index 5d2227d418e..97f21463821 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/SplCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/SplCaster.php
@@ -17,33 +17,49 @@ use Symfony\Component\VarDumper\Cloner\Stub;
* Casts SPL related classes to array representation.
*
* @author Nicolas Grekas
- *
- * @final since Symfony 4.4
*/
class SplCaster
{
- private static $splFileObjectFlags = [
+ private static $splFileObjectFlags = array(
\SplFileObject::DROP_NEW_LINE => 'DROP_NEW_LINE',
\SplFileObject::READ_AHEAD => 'READ_AHEAD',
\SplFileObject::SKIP_EMPTY => 'SKIP_EMPTY',
\SplFileObject::READ_CSV => 'READ_CSV',
- ];
+ );
public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, $isNested)
{
- return self::castSplArray($c, $a, $stub, $isNested);
- }
+ $prefix = Caster::PREFIX_VIRTUAL;
+ $class = $stub->class;
+ $flags = $c->getFlags();
- public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, $isNested)
- {
- return self::castSplArray($c, $a, $stub, $isNested);
+ $b = array(
+ $prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
+ $prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
+ $prefix.'iteratorClass' => $c->getIteratorClass(),
+ $prefix.'storage' => $c->getArrayCopy(),
+ );
+
+ if ($class === 'ArrayObject') {
+ $a = $b;
+ } else {
+ if (!($flags & \ArrayObject::STD_PROP_LIST)) {
+ $c->setFlags(\ArrayObject::STD_PROP_LIST);
+ $a = Caster::castObject($c, new \ReflectionClass($class));
+ $c->setFlags($flags);
+ }
+
+ $a += $b;
+ }
+
+ return $a;
}
public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested)
{
- $a += [
+ $a += array(
Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),
- ];
+ );
return $a;
}
@@ -54,10 +70,10 @@ class SplCaster
$mode = $c->getIteratorMode();
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
- $a += [
- $prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_DELETE) ? 'IT_MODE_DELETE' : 'IT_MODE_KEEP'), $mode),
+ $a += array(
+ $prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_KEEP) ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'), $mode),
$prefix.'dllist' => iterator_to_array($c),
- ];
+ );
$c->setIteratorMode($mode);
return $a;
@@ -65,7 +81,7 @@ class SplCaster
public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNested)
{
- static $map = [
+ static $map = array(
'path' => 'getPath',
'filename' => 'getFilename',
'basename' => 'getBasename',
@@ -88,17 +104,9 @@ class SplCaster
'dir' => 'isDir',
'link' => 'isLink',
'linkTarget' => 'getLinkTarget',
- ];
+ );
$prefix = Caster::PREFIX_VIRTUAL;
- unset($a["\0SplFileInfo\0fileName"]);
- unset($a["\0SplFileInfo\0pathName"]);
-
- if (false === $c->getPathname()) {
- $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
-
- return $a;
- }
foreach ($map as $key => $accessor) {
try {
@@ -107,15 +115,11 @@ class SplCaster
}
}
- if (isset($a[$prefix.'realPath'])) {
- $a[$prefix.'realPath'] = new LinkStub($a[$prefix.'realPath']);
- }
-
if (isset($a[$prefix.'perms'])) {
$a[$prefix.'perms'] = new ConstStub(sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
}
- static $mapDate = ['aTime', 'mTime', 'cTime'];
+ static $mapDate = array('aTime', 'mTime', 'cTime');
foreach ($mapDate as $key) {
if (isset($a[$prefix.$key])) {
$a[$prefix.$key] = new ConstStub(date('Y-m-d H:i:s', $a[$prefix.$key]), $a[$prefix.$key]);
@@ -127,14 +131,14 @@ class SplCaster
public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, $isNested)
{
- static $map = [
+ static $map = array(
'csvControl' => 'getCsvControl',
'flags' => 'getFlags',
'maxLineLen' => 'getMaxLineLen',
'fstat' => 'fstat',
'eof' => 'eof',
'key' => 'key',
- ];
+ );
$prefix = Caster::PREFIX_VIRTUAL;
@@ -146,7 +150,7 @@ class SplCaster
}
if (isset($a[$prefix.'flags'])) {
- $flagsArray = [];
+ $flagsArray = array();
foreach (self::$splFileObjectFlags as $value => $name) {
if ($a[$prefix.'flags'] & $value) {
$flagsArray[] = $name;
@@ -156,29 +160,36 @@ class SplCaster
}
if (isset($a[$prefix.'fstat'])) {
- $a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], ['dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks']);
+ $a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], array('dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks'));
}
return $a;
}
+ public static function castFixedArray(\SplFixedArray $c, array $a, Stub $stub, $isNested)
+ {
+ $a += array(
+ Caster::PREFIX_VIRTUAL.'storage' => $c->toArray(),
+ );
+
+ return $a;
+ }
+
public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, $isNested)
{
- $storage = [];
+ $storage = array();
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
- unset($a["\0SplObjectStorage\0storage"]);
- $clone = clone $c;
- foreach ($clone as $obj) {
- $storage[] = [
+ foreach ($c as $obj) {
+ $storage[spl_object_hash($obj)] = array(
'object' => $obj,
- 'info' => $clone->getInfo(),
- ];
+ 'info' => $c->getInfo(),
+ );
}
- $a += [
+ $a += array(
Caster::PREFIX_VIRTUAL.'storage' => $storage,
- ];
+ );
return $a;
}
@@ -189,35 +200,4 @@ class SplCaster
return $a;
}
-
- public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, $isNested)
- {
- $a[Caster::PREFIX_VIRTUAL.'object'] = $c->get();
-
- return $a;
- }
-
- private static function castSplArray($c, array $a, Stub $stub, bool $isNested): array
- {
- $prefix = Caster::PREFIX_VIRTUAL;
- $flags = $c->getFlags();
-
- if (!($flags & \ArrayObject::STD_PROP_LIST)) {
- $c->setFlags(\ArrayObject::STD_PROP_LIST);
- $a = Caster::castObject($c, \get_class($c), method_exists($c, '__debugInfo'), $stub->class);
- $c->setFlags($flags);
- }
- if (\PHP_VERSION_ID < 70400) {
- $a[$prefix.'storage'] = $c->getArrayCopy();
- }
- $a += [
- $prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
- $prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
- ];
- if ($c instanceof \ArrayObject) {
- $a[$prefix.'iteratorClass'] = new ClassStub($c->getIteratorClass());
- }
-
- return $a;
- }
}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/StubCaster.php b/htdocs/includes/symfony/var-dumper/Caster/StubCaster.php
index b6332fb740f..ebad5ba9844 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/StubCaster.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/StubCaster.php
@@ -17,8 +17,6 @@ use Symfony\Component\VarDumper\Cloner\Stub;
* Casts a caster's Stub.
*
* @author Nicolas Grekas
- *
- * @final since Symfony 4.4
*/
class StubCaster
{
@@ -30,17 +28,9 @@ class StubCaster
$stub->value = $c->value;
$stub->handle = $c->handle;
$stub->cut = $c->cut;
- $stub->attr = $c->attr;
- if (Stub::TYPE_REF === $c->type && !$c->class && \is_string($c->value) && !preg_match('//u', $c->value)) {
- $stub->type = Stub::TYPE_STRING;
- $stub->class = Stub::STRING_BINARY;
- }
-
- $a = [];
+ return array();
}
-
- return $a;
}
public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested)
@@ -51,9 +41,9 @@ class StubCaster
public static function cutInternals($obj, array $a, Stub $stub, $isNested)
{
if ($isNested) {
- $stub->cut += \count($a);
+ $stub->cut += count($a);
- return [];
+ return array();
}
return $a;
@@ -62,17 +52,15 @@ class StubCaster
public static function castEnum(EnumStub $c, array $a, Stub $stub, $isNested)
{
if ($isNested) {
- $stub->class = $c->dumpKeys ? '' : null;
+ $stub->class = '';
$stub->handle = 0;
$stub->value = null;
- $stub->cut = $c->cut;
- $stub->attr = $c->attr;
- $a = [];
+ $a = array();
if ($c->value) {
foreach (array_keys($c->value) as $k) {
- $keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k;
+ $keys[] = Caster::PREFIX_VIRTUAL.$k;
}
// Preserve references with array_combine()
$a = array_combine($keys, $c->value);
diff --git a/htdocs/includes/symfony/var-dumper/Caster/SymfonyCaster.php b/htdocs/includes/symfony/var-dumper/Caster/SymfonyCaster.php
deleted file mode 100644
index ad7bb7166f1..00000000000
--- a/htdocs/includes/symfony/var-dumper/Caster/SymfonyCaster.php
+++ /dev/null
@@ -1,69 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Caster;
-
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\VarDumper\Cloner\Stub;
-
-/**
- * @final since Symfony 4.4
- */
-class SymfonyCaster
-{
- private static $requestGetters = [
- 'pathInfo' => 'getPathInfo',
- 'requestUri' => 'getRequestUri',
- 'baseUrl' => 'getBaseUrl',
- 'basePath' => 'getBasePath',
- 'method' => 'getMethod',
- 'format' => 'getRequestFormat',
- ];
-
- public static function castRequest(Request $request, array $a, Stub $stub, $isNested)
- {
- $clone = null;
-
- foreach (self::$requestGetters as $prop => $getter) {
- $key = Caster::PREFIX_PROTECTED.$prop;
- if (\array_key_exists($key, $a) && null === $a[$key]) {
- if (null === $clone) {
- $clone = clone $request;
- }
- $a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}();
- }
- }
-
- return $a;
- }
-
- public static function castHttpClient($client, array $a, Stub $stub, $isNested)
- {
- $multiKey = sprintf("\0%s\0multi", \get_class($client));
- if (isset($a[$multiKey])) {
- $a[$multiKey] = new CutStub($a[$multiKey]);
- }
-
- return $a;
- }
-
- public static function castHttpClientResponse($response, array $a, Stub $stub, $isNested)
- {
- $stub->cut += \count($a);
- $a = [];
-
- foreach ($response->getInfo() as $k => $v) {
- $a[Caster::PREFIX_VIRTUAL.$k] = $v;
- }
-
- return $a;
- }
-}
diff --git a/htdocs/includes/symfony/var-dumper/Caster/TraceStub.php b/htdocs/includes/symfony/var-dumper/Caster/TraceStub.php
index 5eea1c87668..59548acaee6 100644
--- a/htdocs/includes/symfony/var-dumper/Caster/TraceStub.php
+++ b/htdocs/includes/symfony/var-dumper/Caster/TraceStub.php
@@ -25,7 +25,7 @@ class TraceStub extends Stub
public $sliceLength;
public $numberingOffset;
- public function __construct(array $trace, bool $keepArgs = true, int $sliceOffset = 0, int $sliceLength = null, int $numberingOffset = 0)
+ public function __construct(array $trace, $keepArgs = true, $sliceOffset = 0, $sliceLength = null, $numberingOffset = 0)
{
$this->value = $trace;
$this->keepArgs = $keepArgs;
diff --git a/htdocs/includes/symfony/var-dumper/Caster/UuidCaster.php b/htdocs/includes/symfony/var-dumper/Caster/UuidCaster.php
deleted file mode 100644
index b102774571f..00000000000
--- a/htdocs/includes/symfony/var-dumper/Caster/UuidCaster.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Caster;
-
-use Ramsey\Uuid\UuidInterface;
-use Symfony\Component\VarDumper\Cloner\Stub;
-
-/**
- * @author Grégoire Pineau
- *
- * @final since Symfony 4.4
*/
class XmlResourceCaster
{
- private static $xmlErrors = [
+ private static $xmlErrors = array(
XML_ERROR_NONE => 'XML_ERROR_NONE',
XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY',
XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX',
@@ -45,7 +43,7 @@ class XmlResourceCaster
XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING',
XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION',
XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
- ];
+ );
public static function castXml($h, array $a, Stub $stub, $isNested)
{
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/AbstractCloner.php b/htdocs/includes/symfony/var-dumper/Cloner/AbstractCloner.php
index d7c35d2bd1c..2807ceb935b 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/AbstractCloner.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/AbstractCloner.php
@@ -21,159 +21,111 @@ use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
*/
abstract class AbstractCloner implements ClonerInterface
{
- public static $defaultCasters = [
- '__PHP_Incomplete_Class' => ['Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'],
+ public static $defaultCasters = array(
+ 'Symfony\Component\VarDumper\Caster\CutStub' => 'Symfony\Component\VarDumper\Caster\StubCaster::castStub',
+ 'Symfony\Component\VarDumper\Caster\CutArrayStub' => 'Symfony\Component\VarDumper\Caster\StubCaster::castCutArray',
+ 'Symfony\Component\VarDumper\Caster\ConstStub' => 'Symfony\Component\VarDumper\Caster\StubCaster::castStub',
+ 'Symfony\Component\VarDumper\Caster\EnumStub' => 'Symfony\Component\VarDumper\Caster\StubCaster::castEnum',
- 'Symfony\Component\VarDumper\Caster\CutStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
- 'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'],
- 'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
- 'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'],
+ 'Closure' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castClosure',
+ 'Generator' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castGenerator',
+ 'ReflectionType' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castType',
+ 'ReflectionGenerator' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castReflectionGenerator',
+ 'ReflectionClass' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castClass',
+ 'ReflectionFunctionAbstract' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castFunctionAbstract',
+ 'ReflectionMethod' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castMethod',
+ 'ReflectionParameter' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castParameter',
+ 'ReflectionProperty' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castProperty',
+ 'ReflectionExtension' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castExtension',
+ 'ReflectionZendExtension' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castZendExtension',
- 'Closure' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'],
- 'Generator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'],
- 'ReflectionType' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'],
- 'ReflectionGenerator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'],
- 'ReflectionClass' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'],
- 'ReflectionFunctionAbstract' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'],
- 'ReflectionMethod' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'],
- 'ReflectionParameter' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'],
- 'ReflectionProperty' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'],
- 'ReflectionReference' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReference'],
- 'ReflectionExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'],
- 'ReflectionZendExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'],
+ 'Doctrine\Common\Persistence\ObjectManager' => 'Symfony\Component\VarDumper\Caster\StubCaster::cutInternals',
+ 'Doctrine\Common\Proxy\Proxy' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castCommonProxy',
+ 'Doctrine\ORM\Proxy\Proxy' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castOrmProxy',
+ 'Doctrine\ORM\PersistentCollection' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castPersistentCollection',
- 'Doctrine\Common\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
- 'Doctrine\Common\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'],
- 'Doctrine\ORM\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'],
- 'Doctrine\ORM\PersistentCollection' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'],
- 'Doctrine\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
+ 'DOMException' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castException',
+ 'DOMStringList' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength',
+ 'DOMNameList' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength',
+ 'DOMImplementation' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castImplementation',
+ 'DOMImplementationList' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength',
+ 'DOMNode' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNode',
+ 'DOMNameSpaceNode' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNameSpaceNode',
+ 'DOMDocument' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDocument',
+ 'DOMNodeList' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength',
+ 'DOMNamedNodeMap' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength',
+ 'DOMCharacterData' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castCharacterData',
+ 'DOMAttr' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castAttr',
+ 'DOMElement' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castElement',
+ 'DOMText' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castText',
+ 'DOMTypeinfo' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castTypeinfo',
+ 'DOMDomError' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDomError',
+ 'DOMLocator' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLocator',
+ 'DOMDocumentType' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDocumentType',
+ 'DOMNotation' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNotation',
+ 'DOMEntity' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castEntity',
+ 'DOMProcessingInstruction' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castProcessingInstruction',
+ 'DOMXPath' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castXPath',
- 'DOMException' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
- 'DOMStringList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
- 'DOMNameList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
- 'DOMImplementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'],
- 'DOMImplementationList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
- 'DOMNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'],
- 'DOMNameSpaceNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNameSpaceNode'],
- 'DOMDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'],
- 'DOMNodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
- 'DOMNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
- 'DOMCharacterData' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'],
- 'DOMAttr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'],
- 'DOMElement' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'],
- 'DOMText' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'],
- 'DOMTypeinfo' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'],
- 'DOMDomError' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'],
- 'DOMLocator' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'],
- 'DOMDocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'],
- 'DOMNotation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'],
- 'DOMEntity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'],
- 'DOMProcessingInstruction' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'],
- 'DOMXPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXPath'],
+ 'ErrorException' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castErrorException',
+ 'Exception' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castException',
+ 'Error' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castError',
+ 'Symfony\Component\DependencyInjection\ContainerInterface' => 'Symfony\Component\VarDumper\Caster\StubCaster::cutInternals',
+ 'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castThrowingCasterException',
+ 'Symfony\Component\VarDumper\Caster\TraceStub' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castTraceStub',
+ 'Symfony\Component\VarDumper\Caster\FrameStub' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castFrameStub',
- 'XMLReader' => ['Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'],
+ 'PHPUnit_Framework_MockObject_MockObject' => 'Symfony\Component\VarDumper\Caster\StubCaster::cutInternals',
+ 'Prophecy\Prophecy\ProphecySubjectInterface' => 'Symfony\Component\VarDumper\Caster\StubCaster::cutInternals',
+ 'Mockery\MockInterface' => 'Symfony\Component\VarDumper\Caster\StubCaster::cutInternals',
- 'ErrorException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'],
- 'Exception' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'],
- 'Error' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'],
- 'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
- 'Symfony\Component\EventDispatcher\EventDispatcherInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
- 'Symfony\Component\HttpClient\CurlHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
- 'Symfony\Component\HttpClient\NativeHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'],
- 'Symfony\Component\HttpClient\Response\CurlResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
- 'Symfony\Component\HttpClient\Response\NativeResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'],
- 'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
- 'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'],
- 'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],
- 'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'],
- 'Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
- 'Symfony\Component\ErrorHandler\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'],
+ 'PDO' => 'Symfony\Component\VarDumper\Caster\PdoCaster::castPdo',
+ 'PDOStatement' => 'Symfony\Component\VarDumper\Caster\PdoCaster::castPdoStatement',
- 'Imagine\Image\ImageInterface' => ['Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'],
+ 'AMQPConnection' => 'Symfony\Component\VarDumper\Caster\AmqpCaster::castConnection',
+ 'AMQPChannel' => 'Symfony\Component\VarDumper\Caster\AmqpCaster::castChannel',
+ 'AMQPQueue' => 'Symfony\Component\VarDumper\Caster\AmqpCaster::castQueue',
+ 'AMQPExchange' => 'Symfony\Component\VarDumper\Caster\AmqpCaster::castExchange',
+ 'AMQPEnvelope' => 'Symfony\Component\VarDumper\Caster\AmqpCaster::castEnvelope',
- 'Ramsey\Uuid\UuidInterface' => ['Symfony\Component\VarDumper\Caster\UuidCaster', 'castRamseyUuid'],
+ 'ArrayObject' => 'Symfony\Component\VarDumper\Caster\SplCaster::castArrayObject',
+ 'SplDoublyLinkedList' => 'Symfony\Component\VarDumper\Caster\SplCaster::castDoublyLinkedList',
+ 'SplFileInfo' => 'Symfony\Component\VarDumper\Caster\SplCaster::castFileInfo',
+ 'SplFileObject' => 'Symfony\Component\VarDumper\Caster\SplCaster::castFileObject',
+ 'SplFixedArray' => 'Symfony\Component\VarDumper\Caster\SplCaster::castFixedArray',
+ 'SplHeap' => 'Symfony\Component\VarDumper\Caster\SplCaster::castHeap',
+ 'SplObjectStorage' => 'Symfony\Component\VarDumper\Caster\SplCaster::castObjectStorage',
+ 'SplPriorityQueue' => 'Symfony\Component\VarDumper\Caster\SplCaster::castHeap',
+ 'OuterIterator' => 'Symfony\Component\VarDumper\Caster\SplCaster::castOuterIterator',
- 'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'],
- 'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
- 'PHPUnit\Framework\MockObject\MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
- 'PHPUnit\Framework\MockObject\Stub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
- 'Prophecy\Prophecy\ProphecySubjectInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
- 'Mockery\MockInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
+ 'MongoCursorInterface' => 'Symfony\Component\VarDumper\Caster\MongoCaster::castCursor',
- 'PDO' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'],
- 'PDOStatement' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'],
-
- 'AMQPConnection' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'],
- 'AMQPChannel' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'],
- 'AMQPQueue' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'],
- 'AMQPExchange' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'],
- 'AMQPEnvelope' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'],
-
- 'ArrayObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'],
- 'ArrayIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'],
- 'SplDoublyLinkedList' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'],
- 'SplFileInfo' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'],
- 'SplFileObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'],
- 'SplHeap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
- 'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'],
- 'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
- 'OuterIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'],
- 'WeakReference' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakReference'],
-
- 'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'],
- 'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'],
- 'RedisCluster' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'],
-
- 'DateTimeInterface' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'],
- 'DateInterval' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'],
- 'DateTimeZone' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'],
- 'DatePeriod' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'],
-
- 'GMP' => ['Symfony\Component\VarDumper\Caster\GmpCaster', 'castGmp'],
-
- 'MessageFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castMessageFormatter'],
- 'NumberFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castNumberFormatter'],
- 'IntlTimeZone' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlTimeZone'],
- 'IntlCalendar' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlCalendar'],
- 'IntlDateFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlDateFormatter'],
-
- 'Memcached' => ['Symfony\Component\VarDumper\Caster\MemcachedCaster', 'castMemcached'],
-
- 'Ds\Collection' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castCollection'],
- 'Ds\Map' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castMap'],
- 'Ds\Pair' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPair'],
- 'Symfony\Component\VarDumper\Caster\DsPairStub' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPairStub'],
-
- 'CurlHandle' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
- ':curl' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
-
- ':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
- ':dba persistent' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
- ':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
- ':mysql link' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'],
- ':pgsql large object' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'],
- ':pgsql link' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
- ':pgsql link persistent' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
- ':pgsql result' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'],
- ':process' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'],
- ':stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'],
- ':OpenSSL X.509' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castOpensslX509'],
- ':persistent stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'],
- ':stream-context' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'],
- ':xml' => ['Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'],
- ];
+ ':curl' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castCurl',
+ ':dba' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castDba',
+ ':dba persistent' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castDba',
+ ':gd' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castGd',
+ ':mysql link' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castMysqlLink',
+ ':pgsql large object' => 'Symfony\Component\VarDumper\Caster\PgSqlCaster::castLargeObject',
+ ':pgsql link' => 'Symfony\Component\VarDumper\Caster\PgSqlCaster::castLink',
+ ':pgsql link persistent' => 'Symfony\Component\VarDumper\Caster\PgSqlCaster::castLink',
+ ':pgsql result' => 'Symfony\Component\VarDumper\Caster\PgSqlCaster::castResult',
+ ':process' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castProcess',
+ ':stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream',
+ ':stream-context' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStreamContext',
+ ':xml' => 'Symfony\Component\VarDumper\Caster\XmlResourceCaster::castXml',
+ );
protected $maxItems = 2500;
protected $maxString = -1;
- protected $minDepth = 1;
+ protected $useExt;
- private $casters = [];
+ private $casters = array();
private $prevErrorHandler;
- private $classInfo = [];
+ private $classInfo = array();
private $filter = 0;
/**
- * @param callable[]|null $casters A map of casters
+ * @param callable[]|null $casters A map of casters.
*
* @see addCasters
*/
@@ -183,6 +135,7 @@ abstract class AbstractCloner implements ClonerInterface
$casters = static::$defaultCasters;
}
$this->addCasters($casters);
+ $this->useExt = extension_loaded('symfony_debug');
}
/**
@@ -193,17 +146,17 @@ abstract class AbstractCloner implements ClonerInterface
* Resource types are to be prefixed with a `:`,
* see e.g. static::$defaultCasters.
*
- * @param callable[] $casters A map of casters
+ * @param callable[] $casters A map of casters.
*/
public function addCasters(array $casters)
{
foreach ($casters as $type => $callback) {
- $this->casters[$type][] = $callback;
+ $this->casters[strtolower($type)][] = $callback;
}
}
/**
- * Sets the maximum number of items to clone past the minimum depth in nested structures.
+ * Sets the maximum number of items to clone past the first level in nested structures.
*
* @param int $maxItems
*/
@@ -222,118 +175,88 @@ abstract class AbstractCloner implements ClonerInterface
$this->maxString = (int) $maxString;
}
- /**
- * Sets the minimum tree depth where we are guaranteed to clone all the items. After this
- * depth is reached, only setMaxItems items will be cloned.
- *
- * @param int $minDepth
- */
- public function setMinDepth($minDepth)
- {
- $this->minDepth = (int) $minDepth;
- }
-
/**
* Clones a PHP variable.
*
- * @param mixed $var Any PHP variable
- * @param int $filter A bit field of Caster::EXCLUDE_* constants
+ * @param mixed $var Any PHP variable.
+ * @param int $filter A bit field of Caster::EXCLUDE_* constants.
*
- * @return Data The cloned variable represented by a Data object
+ * @return Data The cloned variable represented by a Data object.
*/
public function cloneVar($var, $filter = 0)
{
- $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
+ $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context) {
if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
// Cloner never dies
throw new \ErrorException($msg, 0, $type, $file, $line);
}
if ($this->prevErrorHandler) {
- return ($this->prevErrorHandler)($type, $msg, $file, $line, $context);
+ return call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context);
}
return false;
});
$this->filter = $filter;
- if ($gc = gc_enabled()) {
- gc_disable();
- }
try {
- return new Data($this->doClone($var));
- } finally {
- if ($gc) {
- gc_enable();
- }
- restore_error_handler();
- $this->prevErrorHandler = null;
+ $data = $this->doClone($var);
+ } catch (\Exception $e) {
}
+ restore_error_handler();
+ $this->prevErrorHandler = null;
+
+ if (isset($e)) {
+ throw $e;
+ }
+
+ return new Data($data);
}
/**
* Effectively clones the PHP variable.
*
- * @param mixed $var Any PHP variable
+ * @param mixed $var Any PHP variable.
*
- * @return array The cloned variable represented in an array
+ * @return array The cloned variable represented in an array.
*/
abstract protected function doClone($var);
/**
* Casts an object to an array representation.
*
- * @param bool $isNested True if the object is nested in the dumped structure
+ * @param Stub $stub The Stub for the casted object.
+ * @param bool $isNested True if the object is nested in the dumped structure.
*
- * @return array The object casted as array
+ * @return array The object casted as array.
*/
protected function castObject(Stub $stub, $isNested)
{
$obj = $stub->value;
$class = $stub->class;
- if (\PHP_VERSION_ID < 80000 ? "\0" === ($class[15] ?? null) : false !== strpos($class, "@anonymous\0")) {
- $stub->class = get_debug_type($obj);
+ if (isset($class[15]) && "\0" === $class[15] && 0 === strpos($class, "class@anonymous\x00")) {
+ $stub->class = get_parent_class($class).'@anonymous';
}
if (isset($this->classInfo[$class])) {
- list($i, $parents, $hasDebugInfo, $fileInfo) = $this->classInfo[$class];
+ $classInfo = $this->classInfo[$class];
} else {
- $i = 2;
- $parents = [$class];
- $hasDebugInfo = method_exists($class, '__debugInfo');
+ $classInfo = array(
+ new \ReflectionClass($class),
+ array_reverse(array($class => $class) + class_parents($class) + class_implements($class) + array('*' => '*')),
+ );
- foreach (class_parents($class) as $p) {
- $parents[] = $p;
- ++$i;
- }
- foreach (class_implements($class) as $p) {
- $parents[] = $p;
- ++$i;
- }
- $parents[] = '*';
-
- $r = new \ReflectionClass($class);
- $fileInfo = $r->isInternal() || $r->isSubclassOf(Stub::class) ? [] : [
- 'file' => $r->getFileName(),
- 'line' => $r->getStartLine(),
- ];
-
- $this->classInfo[$class] = [$i, $parents, $hasDebugInfo, $fileInfo];
+ $this->classInfo[$class] = $classInfo;
}
- $stub->attr += $fileInfo;
- $a = Caster::castObject($obj, $class, $hasDebugInfo, $stub->class);
+ $a = $this->callCaster('Symfony\Component\VarDumper\Caster\Caster::castObject', $obj, $classInfo[0], null, $isNested);
- try {
- while ($i--) {
- if (!empty($this->casters[$p = $parents[$i]])) {
- foreach ($this->casters[$p] as $callback) {
- $a = $callback($obj, $a, $stub, $isNested, $this->filter);
- }
+ foreach ($classInfo[1] as $p) {
+ if (!empty($this->casters[$p = strtolower($p)])) {
+ foreach ($this->casters[$p] as $p) {
+ $a = $this->callCaster($p, $obj, $a, $stub, $isNested);
}
}
- } catch (\Exception $e) {
- $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}
return $a;
@@ -342,24 +265,47 @@ abstract class AbstractCloner implements ClonerInterface
/**
* Casts a resource to an array representation.
*
- * @param bool $isNested True if the object is nested in the dumped structure
+ * @param Stub $stub The Stub for the casted resource.
+ * @param bool $isNested True if the object is nested in the dumped structure.
*
- * @return array The resource casted as array
+ * @return array The resource casted as array.
*/
protected function castResource(Stub $stub, $isNested)
{
- $a = [];
+ $a = array();
$res = $stub->value;
$type = $stub->class;
+ if (!empty($this->casters[':'.$type])) {
+ foreach ($this->casters[':'.$type] as $c) {
+ $a = $this->callCaster($c, $res, $a, $stub, $isNested);
+ }
+ }
+
+ return $a;
+ }
+
+ /**
+ * Calls a custom caster.
+ *
+ * @param callable $callback The caster.
+ * @param object|resource $obj The object/resource being casted.
+ * @param array $a The result of the previous cast for chained casters.
+ * @param Stub $stub The Stub for the casted object/resource.
+ * @param bool $isNested True if $obj is nested in the dumped structure.
+ *
+ * @return array The casted object/resource.
+ */
+ private function callCaster($callback, $obj, $a, $stub, $isNested)
+ {
try {
- if (!empty($this->casters[':'.$type])) {
- foreach ($this->casters[':'.$type] as $callback) {
- $a = $callback($res, $a, $stub, $isNested, $this->filter);
- }
+ $cast = call_user_func($callback, $obj, $a, $stub, $isNested, $this->filter);
+
+ if (is_array($cast)) {
+ $a = $cast;
}
} catch (\Exception $e) {
- $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
+ $a[(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠'] = new ThrowingCasterException($e);
}
return $a;
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/ClonerInterface.php b/htdocs/includes/symfony/var-dumper/Cloner/ClonerInterface.php
index 7ed287a2ddf..c1df5933dbf 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/ClonerInterface.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/ClonerInterface.php
@@ -19,9 +19,9 @@ interface ClonerInterface
/**
* Clones a PHP variable.
*
- * @param mixed $var Any PHP variable
+ * @param mixed $var Any PHP variable.
*
- * @return Data The cloned variable represented by a Data object
+ * @return Data The cloned variable represented by a Data object.
*/
public function cloneVar($var);
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/Cursor.php b/htdocs/includes/symfony/var-dumper/Cloner/Cursor.php
index 5b0542f6c20..162f3293cf2 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/Cursor.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/Cursor.php
@@ -38,6 +38,4 @@ class Cursor
public $hashLength = 0;
public $hashCut = 0;
public $stop = false;
- public $attr = [];
- public $skipChildren = false;
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/Data.php b/htdocs/includes/symfony/var-dumper/Cloner/Data.php
index 8461de9487d..43a7b67971e 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/Data.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/Data.php
@@ -11,24 +11,18 @@
namespace Symfony\Component\VarDumper\Cloner;
-use Symfony\Component\VarDumper\Caster\Caster;
-use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
-
/**
* @author Nicolas Grekas
*/
-class Data implements \ArrayAccess, \Countable, \IteratorAggregate
+class Data
{
private $data;
- private $position = 0;
- private $key = 0;
private $maxDepth = 20;
private $maxItemsPerDepth = -1;
private $useRefHandles = -1;
- private $context = [];
/**
- * @param array $data An array as returned by ClonerInterface::cloneVar()
+ * @param array $data A array as returned by ClonerInterface::cloneVar().
*/
public function __construct(array $data)
{
@@ -36,160 +30,19 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
}
/**
- * @return string|null The type of the value
+ * @return array The raw data structure.
*/
- public function getType()
+ public function getRawData()
{
- $item = $this->data[$this->position][$this->key];
-
- if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
- $item = $item->value;
- }
- if (!$item instanceof Stub) {
- return \gettype($item);
- }
- if (Stub::TYPE_STRING === $item->type) {
- return 'string';
- }
- if (Stub::TYPE_ARRAY === $item->type) {
- return 'array';
- }
- if (Stub::TYPE_OBJECT === $item->type) {
- return $item->class;
- }
- if (Stub::TYPE_RESOURCE === $item->type) {
- return $item->class.' resource';
- }
-
- return null;
- }
-
- /**
- * @param array|bool $recursive Whether values should be resolved recursively or not
- *
- * @return string|int|float|bool|array|Data[]|null A native representation of the original value
- */
- public function getValue($recursive = false)
- {
- $item = $this->data[$this->position][$this->key];
-
- if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
- $item = $item->value;
- }
- if (!($item = $this->getStub($item)) instanceof Stub) {
- return $item;
- }
- if (Stub::TYPE_STRING === $item->type) {
- return $item->value;
- }
-
- $children = $item->position ? $this->data[$item->position] : [];
-
- foreach ($children as $k => $v) {
- if ($recursive && !($v = $this->getStub($v)) instanceof Stub) {
- continue;
- }
- $children[$k] = clone $this;
- $children[$k]->key = $k;
- $children[$k]->position = $item->position;
-
- if ($recursive) {
- if (Stub::TYPE_REF === $v->type && ($v = $this->getStub($v->value)) instanceof Stub) {
- $recursive = (array) $recursive;
- if (isset($recursive[$v->position])) {
- continue;
- }
- $recursive[$v->position] = true;
- }
- $children[$k] = $children[$k]->getValue($recursive);
- }
- }
-
- return $children;
- }
-
- /**
- * @return int
- */
- public function count()
- {
- return \count($this->getValue());
- }
-
- /**
- * @return \Traversable
- */
- public function getIterator()
- {
- if (!\is_array($value = $this->getValue())) {
- throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, \gettype($value)));
- }
-
- yield from $value;
- }
-
- public function __get($key)
- {
- if (null !== $data = $this->seek($key)) {
- $item = $this->getStub($data->data[$data->position][$data->key]);
-
- return $item instanceof Stub || [] === $item ? $data : $item;
- }
-
- return null;
- }
-
- /**
- * @return bool
- */
- public function __isset($key)
- {
- return null !== $this->seek($key);
- }
-
- /**
- * @return bool
- */
- public function offsetExists($key)
- {
- return $this->__isset($key);
- }
-
- public function offsetGet($key)
- {
- return $this->__get($key);
- }
-
- public function offsetSet($key, $value)
- {
- throw new \BadMethodCallException(self::class.' objects are immutable.');
- }
-
- public function offsetUnset($key)
- {
- throw new \BadMethodCallException(self::class.' objects are immutable.');
- }
-
- /**
- * @return string
- */
- public function __toString()
- {
- $value = $this->getValue();
-
- if (!\is_array($value)) {
- return (string) $value;
- }
-
- return sprintf('%s (count=%d)', $this->getType(), \count($value));
+ return $this->data;
}
/**
* Returns a depth limited clone of $this.
*
- * @param int $maxDepth The max dumped depth level
+ * @param int $maxDepth The max dumped depth level.
*
- * @return static
+ * @return self A clone of $this.
*/
public function withMaxDepth($maxDepth)
{
@@ -200,11 +53,11 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
}
/**
- * Limits the number of elements per depth level.
+ * Limits the numbers of elements per depth level.
*
- * @param int $maxItemsPerDepth The max number of items dumped per depth level
+ * @param int $maxItemsPerDepth The max number of items dumped per depth level.
*
- * @return static
+ * @return self A clone of $this.
*/
public function withMaxItemsPerDepth($maxItemsPerDepth)
{
@@ -217,9 +70,9 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
/**
* Enables/disables objects' identifiers tracking.
*
- * @param bool $useRefHandles False to hide global ref. handles
+ * @param bool $useRefHandles False to hide global ref. handles.
*
- * @return static
+ * @return self A clone of $this.
*/
public function withRefHandles($useRefHandles)
{
@@ -229,91 +82,24 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return $data;
}
- /**
- * @return static
- */
- public function withContext(array $context)
- {
- $data = clone $this;
- $data->context = $context;
-
- return $data;
- }
-
- /**
- * Seeks to a specific key in nested data structures.
- *
- * @param string|int $key The key to seek to
- *
- * @return static|null Null if the key is not set
- */
- public function seek($key)
- {
- $item = $this->data[$this->position][$this->key];
-
- if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
- $item = $item->value;
- }
- if (!($item = $this->getStub($item)) instanceof Stub || !$item->position) {
- return null;
- }
- $keys = [$key];
-
- switch ($item->type) {
- case Stub::TYPE_OBJECT:
- $keys[] = Caster::PREFIX_DYNAMIC.$key;
- $keys[] = Caster::PREFIX_PROTECTED.$key;
- $keys[] = Caster::PREFIX_VIRTUAL.$key;
- $keys[] = "\0$item->class\0$key";
- // no break
- case Stub::TYPE_ARRAY:
- case Stub::TYPE_RESOURCE:
- break;
- default:
- return null;
- }
-
- $data = null;
- $children = $this->data[$item->position];
-
- foreach ($keys as $key) {
- if (isset($children[$key]) || \array_key_exists($key, $children)) {
- $data = clone $this;
- $data->key = $key;
- $data->position = $item->position;
- break;
- }
- }
-
- return $data;
- }
-
/**
* Dumps data with a DumperInterface dumper.
*/
public function dump(DumperInterface $dumper)
{
- $refs = [0];
- $cursor = new Cursor();
-
- if ($cursor->attr = $this->context[SourceContextProvider::class] ?? []) {
- $cursor->attr['if_links'] = true;
- $cursor->hashType = -1;
- $dumper->dumpScalar($cursor, 'default', '^');
- $cursor->attr = ['if_links' => true];
- $dumper->dumpScalar($cursor, 'default', ' ');
- $cursor->hashType = 0;
- }
-
- $this->dumpItem($dumper, $cursor, $refs, $this->data[$this->position][$this->key]);
+ $refs = array(0);
+ $this->dumpItem($dumper, new Cursor(), $refs, $this->data[0][0]);
}
/**
* Depth-first dumping of items.
*
- * @param mixed $item A Stub object or the original value being dumped
+ * @param DumperInterface $dumper The dumper being used for dumping.
+ * @param Cursor $cursor A cursor used for tracking dumper state position.
+ * @param array &$refs A map of all references discovered while dumping.
+ * @param mixed $item A Stub object or the original value being dumped.
*/
- private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, $item)
+ private function dumpItem($dumper, $cursor, &$refs, $item)
{
$cursor->refIndex = 0;
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
@@ -321,11 +107,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$firstSeen = true;
if (!$item instanceof Stub) {
- $cursor->attr = [];
- $type = \gettype($item);
- if ($item && 'array' === $type) {
- $item = $this->getStub($item);
- }
+ $type = gettype($item);
} elseif (Stub::TYPE_REF === $item->type) {
if ($item->handle) {
if (!isset($refs[$r = $item->handle - (PHP_INT_MAX >> 1)])) {
@@ -337,9 +119,8 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$cursor->hardRefHandle = $this->useRefHandles & $item->handle;
$cursor->hardRefCount = $item->refCount;
}
- $cursor->attr = $item->attr;
- $type = $item->class ?: \gettype($item->value);
- $item = $this->getStub($item->value);
+ $type = $item->class ?: gettype($item->value);
+ $item = $item->value;
}
if ($item instanceof Stub) {
if ($item->refCount) {
@@ -352,7 +133,6 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
}
$cursor->softRefHandle = $this->useRefHandles & $item->handle;
$cursor->softRefCount = $item->refCount;
- $cursor->attr = $item->attr;
$cut = $item->cut;
if ($item->position && $firstSeen) {
@@ -360,12 +140,12 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
if ($cursor->stop) {
if ($cut >= 0) {
- $cut += \count($children);
+ $cut += count($children);
}
- $children = [];
+ $children = array();
}
} else {
- $children = [];
+ $children = array();
}
switch ($item->type) {
case Stub::TYPE_STRING:
@@ -376,27 +156,21 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
$item = clone $item;
$item->type = $item->class;
$item->class = $item->value;
- // no break
+ // No break;
case Stub::TYPE_OBJECT:
case Stub::TYPE_RESOURCE:
$withChildren = $children && $cursor->depth !== $this->maxDepth && $this->maxItemsPerDepth;
$dumper->enterHash($cursor, $item->type, $item->class, $withChildren);
if ($withChildren) {
- if ($cursor->skipChildren) {
- $withChildren = false;
- $cut = -1;
- } else {
- $cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type, null !== $item->class);
- }
+ $cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type);
} elseif ($children && 0 <= $cut) {
- $cut += \count($children);
+ $cut += count($children);
}
- $cursor->skipChildren = false;
$dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut);
break;
default:
- throw new \RuntimeException(sprintf('Unexpected Stub type: "%s".', $item->type));
+ throw new \RuntimeException(sprintf('Unexpected Stub type: %s', $item->type));
}
} elseif ('array' === $type) {
$dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false);
@@ -411,19 +185,26 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
/**
* Dumps children of hash structures.
*
- * @return int The final number of removed items
+ * @param DumperInterface $dumper
+ * @param Cursor $parentCursor The cursor of the parent hash.
+ * @param array &$refs A map of all references discovered while dumping.
+ * @param array $children The children to dump.
+ * @param int $hashCut The number of items removed from the original hash.
+ * @param string $hashType A Cursor::HASH_* const.
+ *
+ * @return int The final number of removed items.
*/
- private function dumpChildren(DumperInterface $dumper, Cursor $parentCursor, array &$refs, array $children, int $hashCut, int $hashType, bool $dumpKeys): int
+ private function dumpChildren($dumper, $parentCursor, &$refs, $children, $hashCut, $hashType)
{
$cursor = clone $parentCursor;
++$cursor->depth;
$cursor->hashType = $hashType;
$cursor->hashIndex = 0;
- $cursor->hashLength = \count($children);
+ $cursor->hashLength = count($children);
$cursor->hashCut = $hashCut;
foreach ($children as $key => $child) {
$cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key);
- $cursor->hashKey = $dumpKeys ? $key : null;
+ $cursor->hashKey = $key;
$this->dumpItem($dumper, $cursor, $refs, $child);
if (++$cursor->hashIndex === $this->maxItemsPerDepth || $cursor->stop) {
$parentCursor->stop = true;
@@ -434,22 +215,4 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
return $hashCut;
}
-
- private function getStub($item)
- {
- if (!$item || !\is_array($item)) {
- return $item;
- }
-
- $stub = new Stub();
- $stub->type = Stub::TYPE_ARRAY;
- foreach ($item as $stub->class => $stub->position) {
- }
- if (isset($item[0])) {
- $stub->cut = $item[0];
- }
- $stub->value = $stub->cut + ($stub->position ? \count($this->data[$stub->position]) : 0);
-
- return $stub;
- }
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/DumperInterface.php b/htdocs/includes/symfony/var-dumper/Cloner/DumperInterface.php
index ec8ef272789..eba23d42297 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/DumperInterface.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/DumperInterface.php
@@ -21,36 +21,40 @@ interface DumperInterface
/**
* Dumps a scalar value.
*
- * @param string $type The PHP type of the value being dumped
- * @param string|int|float|bool $value The scalar value being dumped
+ * @param Cursor $cursor The Cursor position in the dump.
+ * @param string $type The PHP type of the value being dumped.
+ * @param scalar $value The scalar value being dumped.
*/
public function dumpScalar(Cursor $cursor, $type, $value);
/**
* Dumps a string.
*
- * @param string $str The string being dumped
- * @param bool $bin Whether $str is UTF-8 or binary encoded
- * @param int $cut The number of characters $str has been cut by
+ * @param Cursor $cursor The Cursor position in the dump.
+ * @param string $str The string being dumped.
+ * @param bool $bin Whether $str is UTF-8 or binary encoded.
+ * @param int $cut The number of characters $str has been cut by.
*/
public function dumpString(Cursor $cursor, $str, $bin, $cut);
/**
* Dumps while entering an hash.
*
- * @param int $type A Cursor::HASH_* const for the type of hash
- * @param string|int $class The object class, resource type or array count
- * @param bool $hasChild When the dump of the hash has child item
+ * @param Cursor $cursor The Cursor position in the dump.
+ * @param int $type A Cursor::HASH_* const for the type of hash.
+ * @param string $class The object class, resource type or array count.
+ * @param bool $hasChild When the dump of the hash has child item.
*/
public function enterHash(Cursor $cursor, $type, $class, $hasChild);
/**
* Dumps while leaving an hash.
*
- * @param int $type A Cursor::HASH_* const for the type of hash
- * @param string|int $class The object class, resource type or array count
- * @param bool $hasChild When the dump of the hash has child item
- * @param int $cut The number of items the hash has been cut by
+ * @param Cursor $cursor The Cursor position in the dump.
+ * @param int $type A Cursor::HASH_* const for the type of hash.
+ * @param string $class The object class, resource type or array count.
+ * @param bool $hasChild When the dump of the hash has child item.
+ * @param int $cut The number of items the hash has been cut by.
*/
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut);
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/Stub.php b/htdocs/includes/symfony/var-dumper/Cloner/Stub.php
index 7f6d05d33db..f58a57a7276 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/Stub.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/Stub.php
@@ -18,17 +18,17 @@ namespace Symfony\Component\VarDumper\Cloner;
*/
class Stub
{
- const TYPE_REF = 1;
- const TYPE_STRING = 2;
- const TYPE_ARRAY = 3;
- const TYPE_OBJECT = 4;
- const TYPE_RESOURCE = 5;
+ const TYPE_REF = 'ref';
+ const TYPE_STRING = 'string';
+ const TYPE_ARRAY = 'array';
+ const TYPE_OBJECT = 'object';
+ const TYPE_RESOURCE = 'resource';
- const STRING_BINARY = 1;
- const STRING_UTF8 = 2;
+ const STRING_BINARY = 'bin';
+ const STRING_UTF8 = 'utf8';
- const ARRAY_ASSOC = 1;
- const ARRAY_INDEXED = 2;
+ const ARRAY_ASSOC = 'assoc';
+ const ARRAY_INDEXED = 'indexed';
public $type = self::TYPE_REF;
public $class = '';
@@ -37,31 +37,4 @@ class Stub
public $handle = 0;
public $refCount = 0;
public $position = 0;
- public $attr = [];
-
- private static $defaultProperties = [];
-
- /**
- * @internal
- */
- public function __sleep(): array
- {
- $properties = [];
-
- if (!isset(self::$defaultProperties[$c = static::class])) {
- self::$defaultProperties[$c] = get_class_vars($c);
-
- foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) {
- unset(self::$defaultProperties[$c][$k]);
- }
- }
-
- foreach (self::$defaultProperties[$c] as $k => $v) {
- if ($this->$k !== $v) {
- $properties[] = $k;
- }
- }
-
- return $properties;
- }
}
diff --git a/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php b/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
index b659fc341b8..98d6e9e51c1 100644
--- a/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
+++ b/htdocs/includes/symfony/var-dumper/Cloner/VarCloner.php
@@ -16,173 +16,135 @@ namespace Symfony\Component\VarDumper\Cloner;
*/
class VarCloner extends AbstractCloner
{
- private static $gid;
- private static $arrayCache = [];
+ private static $hashMask = 0;
+ private static $hashOffset = 0;
/**
* {@inheritdoc}
*/
protected function doClone($var)
{
+ $useExt = $this->useExt;
+ $i = 0; // Current iteration position in $queue
$len = 1; // Length of $queue
- $pos = 0; // Number of cloned items past the minimum depth
- $refsCounter = 0; // Hard references counter
- $queue = [[$var]]; // This breadth-first queue is the return value
- $indexedArrays = []; // Map of queue indexes that hold numerically indexed arrays
- $hardRefs = []; // Map of original zval ids to stub objects
- $objRefs = []; // Map of original object handles to their stub object counterpart
- $objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
- $resRefs = []; // Map of original resource handles to their stub object counterpart
- $values = []; // Map of stub objects' ids to original values
+ $pos = 0; // Number of cloned items past the first level
+ $refs = 0; // Hard references counter
+ $queue = array(array($var)); // This breadth-first queue is the return value
+ $arrayRefs = array(); // Map of queue indexes to stub array objects
+ $hardRefs = array(); // Map of original zval hashes to stub objects
+ $objRefs = array(); // Map of original object handles to their stub object couterpart
+ $resRefs = array(); // Map of original resource handles to their stub object couterpart
+ $values = array(); // Map of stub objects' hashes to original values
$maxItems = $this->maxItems;
$maxString = $this->maxString;
- $minDepth = $this->minDepth;
- $currentDepth = 0; // Current tree depth
- $currentDepthFinalIndex = 0; // Final $queue index for current tree depth
- $minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached
- $cookie = (object) []; // Unique object used to detect hard references
+ $cookie = (object) array(); // Unique object used to detect hard references
+ $gid = uniqid(mt_rand(), true); // Unique string used to detect the special $GLOBALS variable
$a = null; // Array cast for nested structures
$stub = null; // Stub capturing the main properties of an original item value
// or null if the original value is used directly
-
- if (!$gid = self::$gid) {
- $gid = self::$gid = md5(random_bytes(6)); // Unique string used to detect the special $GLOBALS variable
+ $zval = array( // Main properties of the current value
+ 'type' => null,
+ 'zval_isref' => null,
+ 'zval_hash' => null,
+ 'array_count' => null,
+ 'object_class' => null,
+ 'object_handle' => null,
+ 'resource_type' => null,
+ );
+ if (!self::$hashMask) {
+ self::initHashMask();
}
- $arrayStub = new Stub();
- $arrayStub->type = Stub::TYPE_ARRAY;
- $fromObjCast = false;
+ $hashMask = self::$hashMask;
+ $hashOffset = self::$hashOffset;
for ($i = 0; $i < $len; ++$i) {
- // Detect when we move on to the next tree depth
- if ($i > $currentDepthFinalIndex) {
- ++$currentDepth;
- $currentDepthFinalIndex = $len - 1;
- if ($currentDepth >= $minDepth) {
- $minimumDepthReached = true;
- }
- }
-
- $refs = $vals = $queue[$i];
- if (\PHP_VERSION_ID < 70200 && empty($indexedArrays[$i])) {
- // see https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts
- foreach ($vals as $k => $v) {
- if (\is_int($k)) {
- continue;
- }
- foreach ([$k => true] as $gk => $gv) {
- }
- if ($gk !== $k) {
- $fromObjCast = true;
- $refs = $vals = array_values($queue[$i]);
- break;
- }
- }
- }
- foreach ($vals as $k => $v) {
+ $indexed = true; // Whether the currently iterated array is numerically indexed or not
+ $j = -1; // Position in the currently iterated array
+ $step = $queue[$i]; // Copy of the currently iterated array used for hard references detection
+ foreach ($step as $k => $v) {
+ // $k is the original key
// $v is the original value or a stub object in case of hard references
-
- if (\PHP_VERSION_ID >= 70400) {
- $zvalIsRef = null !== \ReflectionReference::fromArrayElement($vals, $k);
- } else {
- $refs[$k] = $cookie;
- $zvalIsRef = $vals[$k] === $cookie;
+ if ($indexed && $k !== ++$j) {
+ $indexed = false;
}
-
- if ($zvalIsRef) {
- $vals[$k] = &$stub; // Break hard references to make $queue completely
+ if ($useExt) {
+ $zval = symfony_zval_info($k, $step);
+ } else {
+ $step[$k] = $cookie;
+ if ($zval['zval_isref'] = $queue[$i][$k] === $cookie) {
+ $zval['zval_hash'] = $v instanceof Stub ? spl_object_hash($v) : null;
+ }
+ $zval['type'] = gettype($v);
+ }
+ if ($zval['zval_isref']) {
+ $queue[$i][$k] = &$stub; // Break hard references to make $queue completely
unset($stub); // independent from the original structure
- if ($v instanceof Stub && isset($hardRefs[spl_object_id($v)])) {
- $vals[$k] = $refs[$k] = $v;
+ if (isset($hardRefs[$zval['zval_hash']])) {
+ $queue[$i][$k] = $useExt ? ($v = $hardRefs[$zval['zval_hash']]) : ($step[$k] = $v);
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
++$v->value->refCount;
}
++$v->refCount;
continue;
}
- $refs[$k] = $vals[$k] = new Stub();
- $refs[$k]->value = $v;
- $h = spl_object_id($refs[$k]);
- $hardRefs[$h] = &$refs[$k];
- $values[$h] = $v;
- $vals[$k]->handle = ++$refsCounter;
}
// Create $stub when the original value $v can not be used directly
// If $v is a nested structure, put that structure in array $a
- switch (true) {
- case null === $v:
- case \is_bool($v):
- case \is_int($v):
- case \is_float($v):
- continue 2;
- case \is_string($v):
- if ('' === $v) {
- continue 2;
- }
- if (!preg_match('//u', $v)) {
+ switch ($zval['type']) {
+ case 'string':
+ if (isset($v[0]) && !preg_match('//u', $v)) {
$stub = new Stub();
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_BINARY;
- if (0 <= $maxString && 0 < $cut = \strlen($v) - $maxString) {
+ if (0 <= $maxString && 0 < $cut = strlen($v) - $maxString) {
$stub->cut = $cut;
$stub->value = substr($v, 0, -$cut);
} else {
$stub->value = $v;
}
- } elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = mb_strlen($v, 'UTF-8') - $maxString) {
+ } elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = iconv_strlen($v, 'UTF-8') - $maxString) {
$stub = new Stub();
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_UTF8;
$stub->cut = $cut;
- $stub->value = mb_substr($v, 0, $maxString, 'UTF-8');
- } else {
- continue 2;
+ $stub->value = iconv_substr($v, 0, $maxString, 'UTF-8');
}
- $a = null;
break;
- case \is_array($v):
- if (!$v) {
- continue 2;
- }
- $stub = $arrayStub;
- $stub->class = Stub::ARRAY_INDEXED;
+ case 'integer':
+ break;
- $j = -1;
- foreach ($v as $gk => $gv) {
- if ($gk !== ++$j) {
- $stub->class = Stub::ARRAY_ASSOC;
- break;
- }
- }
- $a = $v;
+ case 'array':
+ if ($v) {
+ $stub = $arrayRefs[$len] = new Stub();
+ $stub->type = Stub::TYPE_ARRAY;
+ $stub->class = Stub::ARRAY_ASSOC;
- if (Stub::ARRAY_ASSOC === $stub->class) {
// Copies of $GLOBALS have very strange behavior,
// let's detect them with some black magic
+ $a = $v;
$a[$gid] = true;
// Happens with copies of $GLOBALS
if (isset($v[$gid])) {
unset($v[$gid]);
- $a = [];
+ $a = array();
foreach ($v as $gk => &$gv) {
$a[$gk] = &$gv;
}
- unset($gv);
} else {
$a = $v;
}
- } elseif (\PHP_VERSION_ID < 70200) {
- $indexedArrays[$len] = true;
+
+ $stub->value = $zval['array_count'] ?: count($a);
}
break;
- case \is_object($v):
- case $v instanceof \__PHP_Incomplete_Class:
- if (empty($objRefs[$h = spl_object_id($v)])) {
+ case 'object':
+ if (empty($objRefs[$h = $zval['object_handle'] ?: ($hashMask ^ hexdec(substr(spl_object_hash($v), $hashOffset, PHP_INT_SIZE)))])) {
$stub = new Stub();
$stub->type = Stub::TYPE_OBJECT;
- $stub->class = \get_class($v);
+ $stub->class = $zval['object_class'] ?: get_class($v);
$stub->value = $v;
$stub->handle = $h;
$a = $this->castObject($stub, 0 < $i);
@@ -190,17 +152,23 @@ class VarCloner extends AbstractCloner
if (Stub::TYPE_OBJECT !== $stub->type || null === $stub->value) {
break;
}
- $stub->handle = $h = spl_object_id($stub->value);
+ if ($useExt) {
+ $zval['type'] = $stub->value;
+ $zval = symfony_zval_info('type', $zval);
+ $h = $zval['object_handle'];
+ } else {
+ $h = $hashMask ^ hexdec(substr(spl_object_hash($stub->value), $hashOffset, PHP_INT_SIZE));
+ }
+ $stub->handle = $h;
}
$stub->value = null;
- if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) {
- $stub->cut = \count($a);
+ if (0 <= $maxItems && $maxItems <= $pos) {
+ $stub->cut = count($a);
$a = null;
}
}
if (empty($objRefs[$h])) {
$objRefs[$h] = $stub;
- $objects[] = $v;
} else {
$stub = $objRefs[$h];
++$stub->refCount;
@@ -208,19 +176,18 @@ class VarCloner extends AbstractCloner
}
break;
- default: // resource
+ case 'resource':
+ case 'unknown type':
if (empty($resRefs[$h = (int) $v])) {
$stub = new Stub();
$stub->type = Stub::TYPE_RESOURCE;
- if ('Unknown' === $stub->class = @get_resource_type($v)) {
- $stub->class = 'Closed';
- }
+ $stub->class = $zval['resource_type'] ?: get_resource_type($v);
$stub->value = $v;
$stub->handle = $h;
$a = $this->castResource($stub, 0 < $i);
$stub->value = null;
- if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) {
- $stub->cut = \count($a);
+ if (0 <= $maxItems && $maxItems <= $pos) {
+ $stub->cut = count($a);
$a = null;
}
}
@@ -234,62 +201,67 @@ class VarCloner extends AbstractCloner
break;
}
- if ($a) {
- if (!$minimumDepthReached || 0 > $maxItems) {
- $queue[$len] = $a;
- $stub->position = $len++;
- } elseif ($pos < $maxItems) {
- if ($maxItems < $pos += \count($a)) {
- $a = \array_slice($a, 0, $maxItems - $pos);
- if ($stub->cut >= 0) {
- $stub->cut += $pos - $maxItems;
+ if (isset($stub)) {
+ if ($zval['zval_isref']) {
+ if ($useExt) {
+ $queue[$i][$k] = $hardRefs[$zval['zval_hash']] = $v = new Stub();
+ $v->value = $stub;
+ } else {
+ $step[$k] = new Stub();
+ $step[$k]->value = $stub;
+ $h = spl_object_hash($step[$k]);
+ $queue[$i][$k] = $hardRefs[$h] = &$step[$k];
+ $values[$h] = $v;
+ }
+ $queue[$i][$k]->handle = ++$refs;
+ } else {
+ $queue[$i][$k] = $stub;
+ }
+
+ if ($a) {
+ if ($i && 0 <= $maxItems) {
+ $k = count($a);
+ if ($pos < $maxItems) {
+ if ($maxItems < $pos += $k) {
+ $a = array_slice($a, 0, $maxItems - $pos);
+ if ($stub->cut >= 0) {
+ $stub->cut += $pos - $maxItems;
+ }
+ }
+ } else {
+ if ($stub->cut >= 0) {
+ $stub->cut += $k;
+ }
+ $stub = $a = null;
+ unset($arrayRefs[$len]);
+ continue;
}
}
$queue[$len] = $a;
$stub->position = $len++;
- } elseif ($stub->cut >= 0) {
- $stub->cut += \count($a);
- $stub->position = 0;
}
- }
-
- if ($arrayStub === $stub) {
- if ($arrayStub->cut) {
- $stub = [$arrayStub->cut, $arrayStub->class => $arrayStub->position];
- $arrayStub->cut = 0;
- } elseif (isset(self::$arrayCache[$arrayStub->class][$arrayStub->position])) {
- $stub = self::$arrayCache[$arrayStub->class][$arrayStub->position];
+ $stub = $a = null;
+ } elseif ($zval['zval_isref']) {
+ if ($useExt) {
+ $queue[$i][$k] = $hardRefs[$zval['zval_hash']] = new Stub();
+ $queue[$i][$k]->value = $v;
} else {
- self::$arrayCache[$arrayStub->class][$arrayStub->position] = $stub = [$arrayStub->class => $arrayStub->position];
+ $step[$k] = $queue[$i][$k] = new Stub();
+ $step[$k]->value = $v;
+ $h = spl_object_hash($step[$k]);
+ $hardRefs[$h] = &$step[$k];
+ $values[$h] = $v;
}
- }
-
- if ($zvalIsRef) {
- $refs[$k]->value = $stub;
- } else {
- $vals[$k] = $stub;
+ $queue[$i][$k]->handle = ++$refs;
}
}
- if ($fromObjCast) {
- $fromObjCast = false;
- $refs = $vals;
- $vals = [];
- $j = -1;
- foreach ($queue[$i] as $k => $v) {
- foreach ([$k => true] as $gk => $gv) {
- }
- if ($gk !== $k) {
- $vals = (object) $vals;
- $vals->{$k} = $refs[++$j];
- $vals = (array) $vals;
- } else {
- $vals[$k] = $refs[++$j];
- }
+ if (isset($arrayRefs[$i])) {
+ if ($indexed) {
+ $arrayRefs[$i]->class = Stub::ARRAY_INDEXED;
}
+ unset($arrayRefs[$i]);
}
-
- $queue[$i] = $vals;
}
foreach ($values as $h => $v) {
@@ -298,4 +270,31 @@ class VarCloner extends AbstractCloner
return $queue;
}
+
+ private static function initHashMask()
+ {
+ $obj = (object) array();
+ self::$hashOffset = 16 - PHP_INT_SIZE;
+ self::$hashMask = -1;
+
+ if (defined('HHVM_VERSION')) {
+ self::$hashOffset += 16;
+ } else {
+ // check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
+ $obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush');
+ foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
+ if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) {
+ $frame['line'] = 0;
+ break;
+ }
+ }
+ if (!empty($frame['line'])) {
+ ob_start();
+ debug_zval_dump($obj);
+ self::$hashMask = substr(ob_get_clean(), 17);
+ }
+ }
+
+ self::$hashMask ^= hexdec(substr(spl_object_hash($obj), self::$hashOffset, PHP_INT_SIZE));
+ }
}
diff --git a/htdocs/includes/symfony/var-dumper/Command/Descriptor/CliDescriptor.php b/htdocs/includes/symfony/var-dumper/Command/Descriptor/CliDescriptor.php
deleted file mode 100644
index dc77d03ecd8..00000000000
--- a/htdocs/includes/symfony/var-dumper/Command/Descriptor/CliDescriptor.php
+++ /dev/null
@@ -1,88 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Command\Descriptor;
-
-use Symfony\Component\Console\Formatter\OutputFormatterStyle;
-use Symfony\Component\Console\Input\ArrayInput;
-use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Style\SymfonyStyle;
-use Symfony\Component\VarDumper\Cloner\Data;
-use Symfony\Component\VarDumper\Dumper\CliDumper;
-
-/**
- * Describe collected data clones for cli output.
- *
- * @author Maxime Steinhausser
- $sourceDescription
-
- * @author Maxime Steinhausser
*/
- function dump($var, ...$moreVars)
+ function dump($var)
{
- VarDumper::dump($var);
-
- foreach ($moreVars as $v) {
- VarDumper::dump($v);
+ foreach (func_get_args() as $var) {
+ VarDumper::dump($var);
}
-
- if (1 < func_num_args()) {
- return func_get_args();
- }
-
- return $var;
- }
-}
-
-if (!function_exists('dd')) {
- function dd(...$vars)
- {
- foreach ($vars as $v) {
- VarDumper::dump($v);
- }
-
- exit(1);
}
}
diff --git a/htdocs/includes/symfony/var-dumper/Resources/js/htmlDescriptor.js b/htdocs/includes/symfony/var-dumper/Resources/js/htmlDescriptor.js
deleted file mode 100644
index 63101e57c3c..00000000000
--- a/htdocs/includes/symfony/var-dumper/Resources/js/htmlDescriptor.js
+++ /dev/null
@@ -1,10 +0,0 @@
-document.addEventListener('DOMContentLoaded', function() {
- let prev = null;
- Array.from(document.getElementsByTagName('article')).reverse().forEach(function (article) {
- const dedupId = article.dataset.dedupId;
- if (dedupId === prev) {
- article.getElementsByTagName('header')[0].classList.add('hidden');
- }
- prev = dedupId;
- });
-});
diff --git a/htdocs/includes/symfony/var-dumper/Server/Connection.php b/htdocs/includes/symfony/var-dumper/Server/Connection.php
deleted file mode 100644
index 8b814cb61ca..00000000000
--- a/htdocs/includes/symfony/var-dumper/Server/Connection.php
+++ /dev/null
@@ -1,95 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Server;
-
-use Symfony\Component\VarDumper\Cloner\Data;
-use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
-
-/**
- * Forwards serialized Data clones to a server.
- *
- * @author Maxime Steinhausser
+ */
+class CasterTest extends \PHPUnit_Framework_TestCase
+{
+ use VarDumperTestTrait;
+
+ private $referenceArray = array(
+ 'null' => null,
+ 'empty' => false,
+ 'public' => 'pub',
+ "\0~\0virtual" => 'virt',
+ "\0+\0dynamic" => 'dyn',
+ "\0*\0protected" => 'prot',
+ "\0Foo\0private" => 'priv',
+ );
+
+ /**
+ * @dataProvider provideFilter
+ */
+ public function testFilter($filter, $expectedDiff, $listedProperties = null)
+ {
+ if (null === $listedProperties) {
+ $filteredArray = Caster::filter($this->referenceArray, $filter);
+ } else {
+ $filteredArray = Caster::filter($this->referenceArray, $filter, $listedProperties);
+ }
+
+ $this->assertSame($expectedDiff, array_diff_assoc($this->referenceArray, $filteredArray));
+ }
+
+ public function provideFilter()
+ {
+ return array(
+ array(
+ 0,
+ array(),
+ ),
+ array(
+ Caster::EXCLUDE_PUBLIC,
+ array(
+ 'null' => null,
+ 'empty' => false,
+ 'public' => 'pub',
+ ),
+ ),
+ array(
+ Caster::EXCLUDE_NULL,
+ array(
+ 'null' => null,
+ ),
+ ),
+ array(
+ Caster::EXCLUDE_EMPTY,
+ array(
+ 'null' => null,
+ 'empty' => false,
+ ),
+ ),
+ array(
+ Caster::EXCLUDE_VIRTUAL,
+ array(
+ "\0~\0virtual" => 'virt',
+ ),
+ ),
+ array(
+ Caster::EXCLUDE_DYNAMIC,
+ array(
+ "\0+\0dynamic" => 'dyn',
+ ),
+ ),
+ array(
+ Caster::EXCLUDE_PROTECTED,
+ array(
+ "\0*\0protected" => 'prot',
+ ),
+ ),
+ array(
+ Caster::EXCLUDE_PRIVATE,
+ array(
+ "\0Foo\0private" => 'priv',
+ ),
+ ),
+ array(
+ Caster::EXCLUDE_VERBOSE,
+ array(
+ 'public' => 'pub',
+ "\0*\0protected" => 'prot',
+ ),
+ array('public', "\0*\0protected"),
+ ),
+ array(
+ Caster::EXCLUDE_NOT_IMPORTANT,
+ array(
+ 'null' => null,
+ 'empty' => false,
+ "\0~\0virtual" => 'virt',
+ "\0+\0dynamic" => 'dyn',
+ "\0Foo\0private" => 'priv',
+ ),
+ array('public', "\0*\0protected"),
+ ),
+ array(
+ Caster::EXCLUDE_VIRTUAL | Caster::EXCLUDE_DYNAMIC,
+ array(
+ "\0~\0virtual" => 'virt',
+ "\0+\0dynamic" => 'dyn',
+ ),
+ ),
+ array(
+ Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE,
+ $this->referenceArray,
+ array('public', "\0*\0protected"),
+ ),
+ array(
+ Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY,
+ array(
+ 'null' => null,
+ 'empty' => false,
+ "\0~\0virtual" => 'virt',
+ "\0+\0dynamic" => 'dyn',
+ "\0*\0protected" => 'prot',
+ "\0Foo\0private" => 'priv',
+ ),
+ array('public', 'empty'),
+ ),
+ array(
+ Caster::EXCLUDE_VERBOSE | Caster::EXCLUDE_EMPTY | Caster::EXCLUDE_STRICT,
+ array(
+ 'empty' => false,
+ ),
+ array('public', 'empty'),
+ ),
+ );
+ }
+
+ /**
+ * @requires PHP 7.0
+ */
+ public function testAnonymousClass()
+ {
+ $c = eval('return new class extends stdClass { private $foo = "foo"; };');
+
+ $this->assertDumpMatchesFormat(
+ <<<'EOTXT'
+stdClass@anonymous {
+ -foo: "foo"
+}
+EOTXT
+ , $c
+ );
+
+ $c = eval('return new class { private $foo = "foo"; };');
+
+ $this->assertDumpMatchesFormat(
+ <<<'EOTXT'
+@anonymous {
+ -foo: "foo"
+}
+EOTXT
+ , $c
+ );
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/PdoCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
new file mode 100644
index 00000000000..faa65341170
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
@@ -0,0 +1,57 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Tests\Caster;
+
+use Symfony\Component\VarDumper\Caster\PdoCaster;
+use Symfony\Component\VarDumper\Cloner\Stub;
+
+/**
+ * @author Nicolas Grekas
+ */
+class PdoCasterTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @requires extension pdo_sqlite
+ */
+ public function testCastPdo()
+ {
+ $pdo = new \PDO('sqlite::memory:');
+ $pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo)));
+
+ $cast = PdoCaster::castPdo($pdo, array(), new Stub(), false);
+
+ $this->assertInstanceOf('Symfony\Component\VarDumper\Caster\EnumStub', $cast["\0~\0attributes"]);
+
+ $attr = $cast["\0~\0attributes"] = $cast["\0~\0attributes"]->value;
+ $this->assertInstanceOf('Symfony\Component\VarDumper\Caster\ConstStub', $attr['CASE']);
+ $this->assertSame('NATURAL', $attr['CASE']->class);
+ $this->assertSame('BOTH', $attr['DEFAULT_FETCH_MODE']->class);
+
+ $xCast = array(
+ "\0~\0inTransaction" => $pdo->inTransaction(),
+ "\0~\0attributes" => array(
+ 'CASE' => $attr['CASE'],
+ 'ERRMODE' => $attr['ERRMODE'],
+ 'PERSISTENT' => false,
+ 'DRIVER_NAME' => 'sqlite',
+ 'ORACLE_NULLS' => $attr['ORACLE_NULLS'],
+ 'CLIENT_VERSION' => $pdo->getAttribute(\PDO::ATTR_CLIENT_VERSION),
+ 'SERVER_VERSION' => $pdo->getAttribute(\PDO::ATTR_SERVER_VERSION),
+ 'STATEMENT_CLASS' => array('PDOStatement'),
+ 'DEFAULT_FETCH_MODE' => $attr['DEFAULT_FETCH_MODE'],
+ ),
+ );
+ unset($cast["\0~\0attributes"]['STATEMENT_CLASS'][1]);
+
+ $this->assertSame($xCast, $cast);
+ }
+}
diff --git a/htdocs/includes/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php b/htdocs/includes/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
new file mode 100644
index 00000000000..0d7147fbcd2
--- /dev/null
+++ b/htdocs/includes/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
@@ -0,0 +1,228 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\VarDumper\Tests\Caster;
+
+use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
+use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo;
+
+/**
+ * @author Nicolas Grekas
+ */
+class ReflectionCasterTest extends \PHPUnit_Framework_TestCase
+{
+ use VarDumperTestTrait;
+
+ public function testReflectionCaster()
+ {
+ $var = new \ReflectionClass('ReflectionClass');
+
+ $this->assertDumpMatchesFormat(
+ <<<'EOTXT'
+ReflectionClass {
+ +name: "ReflectionClass"
+%Aimplements: array:%d [
+ 0 => "Reflector"
+%A]
+ constants: array:3 [
+ "IS_IMPLICIT_ABSTRACT" => 16
+ "IS_EXPLICIT_ABSTRACT" => 32
+ "IS_FINAL" => %d
+ ]
+ properties: array:%d [
+ "name" => ReflectionProperty {
+%A +name: "name"
+ +class: "ReflectionClass"
+%A modifiers: "public"
+ }
+%A]
+ methods: array:%d [
+%A
+ "export" => ReflectionMethod {
+ +name: "export"
+ +class: "ReflectionClass"
+ parameters: {
+ $%s: ReflectionParameter {
+%A position: 0
+%A
+}
+EOTXT
+ , $var
+ );
+ }
+
+ public function testClosureCaster()
+ {
+ $a = $b = 123;
+ $var = function ($x) use ($a, &$b) {};
+
+ $this->assertDumpMatchesFormat(
+ <<
+ */
+class CliDumperTest extends \PHPUnit_Framework_TestCase
+{
+ use VarDumperTestTrait;
+
+ public function testGet()
+ {
+ require __DIR__.'/Fixtures/dumb-var.php';
+
+ $dumper = new CliDumper('php://output');
+ $dumper->setColors(false);
+ $cloner = new VarCloner();
+ $cloner->addCasters(array(
+ ':stream' => function ($res, $a) {
+ unset($a['uri'], $a['wrapper_data']);
+
+ return $a;
+ },
+ ));
+ $data = $cloner->cloneVar($var);
+
+ ob_start();
+ $dumper->dump($data);
+ $out = ob_get_clean();
+ $out = preg_replace('/[ \t]+$/m', '', $out);
+ $intMax = PHP_INT_MAX;
+ $res = (int) $var['res'];
+
+ $r = defined('HHVM_VERSION') ? '' : '#%d';
+ $this->assertStringMatchesFormat(
+ <<
+ */
+class HtmlDumperTest extends \PHPUnit_Framework_TestCase
+{
+ public function testGet()
+ {
+ require __DIR__.'/Fixtures/dumb-var.php';
+
+ $dumper = new HtmlDumper('php://output');
+ $dumper->setDumpHeader('
+ */
+class VarClonerTest extends \PHPUnit_Framework_TestCase
+{
+ public function testMaxIntBoundary()
+ {
+ $data = array(PHP_INT_MAX => 123);
+
+ $cloner = new VarCloner();
+ $clone = $cloner->cloneVar($data);
+
+ $expected = <<%s %s', $request['method'], $uri = $request['uri'], $uri);
- $dedupIdentifier = $request['identifier'];
- } elseif (isset($context['cli'])) {
- $title = '$ '.$context['cli']['command_line'];
- $dedupIdentifier = $context['cli']['identifier'];
- } else {
- $dedupIdentifier = uniqid('', true);
- }
-
- $sourceDescription = '';
- if (isset($context['source'])) {
- $source = $context['source'];
- $projectDir = $source['project_dir'] ?? null;
- $sourceDescription = sprintf('%s on line %d', $source['name'], $source['line']);
- if (isset($source['file_link'])) {
- $sourceDescription = sprintf('%s', $source['file_link'], $sourceDescription);
- }
- }
-
- $isoDate = $this->extractDate($context, 'c');
- $tags = array_filter([
- 'controller' => $controller ?? null,
- 'project dir' => $projectDir ?? null,
- ]);
-
- $output->writeln(<<
- $title
-
- '.$this->htmlEncode($src[$i - 1]).''.implode("\n", $fileExcerpt).'
';
- }
- }
- break;
- }
- }
- break;
- }
- }
-
- if (false === $name) {
- $name = str_replace('\\', '/', $file);
- $name = substr($name, strrpos($name, '/') + 1);
- }
-
- $context = ['name' => $name, 'file' => $file, 'line' => $line];
- $context['file_excerpt'] = $fileExcerpt;
-
- if (null !== $this->projectDir) {
- $context['project_dir'] = $this->projectDir;
- if (0 === strpos($file, $this->projectDir)) {
- $context['file_relative'] = ltrim(substr($file, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
- }
- }
-
- if ($this->fileLinkFormatter && $fileLink = $this->fileLinkFormatter->format($context['file'], $context['line'])) {
- $context['file_link'] = $fileLink;
- }
-
- return $context;
- }
-
- private function htmlEncode(string $s): string
- {
- $html = '';
-
- $dumper = new HtmlDumper(function ($line) use (&$html) { $html .= $line; }, $this->charset);
- $dumper->setDumpHeader('');
- $dumper->setDumpBoundaries('', '');
-
- $cloner = new VarCloner();
- $dumper->dump($cloner->cloneVar($s));
-
- return substr(strip_tags($html), 1, -1);
- }
-}
diff --git a/htdocs/includes/symfony/var-dumper/Dumper/ContextualizedDumper.php b/htdocs/includes/symfony/var-dumper/Dumper/ContextualizedDumper.php
deleted file mode 100644
index 76384176ef0..00000000000
--- a/htdocs/includes/symfony/var-dumper/Dumper/ContextualizedDumper.php
+++ /dev/null
@@ -1,43 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Dumper;
-
-use Symfony\Component\VarDumper\Cloner\Data;
-use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
-
-/**
- * @author Kévin Thérage ';
- protected $dumpSuffix = '
';
+ protected $dumpSuffix = '';
protected $dumpId = 'sf-dump';
protected $colors = true;
protected $headerIsDumped = false;
protected $lastDepth = -1;
- protected $styles;
-
- private $displayOptions = [
- 'maxDepth' => 1,
- 'maxStringLength' => 160,
- 'fileLinkFormat' => null,
- ];
- private $extraDisplayOptions = [];
+ protected $styles = array(
+ 'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:100000; word-break: normal',
+ 'num' => 'font-weight:bold; color:#1299DA',
+ 'const' => 'font-weight:bold',
+ 'str' => 'font-weight:bold; color:#56DB3A',
+ 'note' => 'color:#1299DA',
+ 'ref' => 'color:#A0A0A0',
+ 'public' => 'color:#FFFFFF',
+ 'protected' => 'color:#FFFFFF',
+ 'private' => 'color:#FFFFFF',
+ 'meta' => 'color:#B729D9',
+ 'key' => 'color:#56DB3A',
+ 'index' => 'color:#1299DA',
+ );
/**
* {@inheritdoc}
*/
- public function __construct($output = null, string $charset = null, int $flags = 0)
+ public function __construct($output = null, $charset = null)
{
- AbstractDumper::__construct($output, $charset, $flags);
+ AbstractDumper::__construct($output, $charset);
$this->dumpId = 'sf-dump-'.mt_rand();
- $this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
- $this->styles = static::$themes['dark'] ?? self::$themes['dark'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setOutput($output)
+ {
+ if ($output !== $prev = parent::setOutput($output)) {
+ $this->headerIsDumped = false;
+ }
+
+ return $prev;
}
/**
@@ -94,30 +75,10 @@ class HtmlDumper extends CliDumper
$this->styles = $styles + $this->styles;
}
- public function setTheme(string $themeName)
- {
- if (!isset(static::$themes[$themeName])) {
- throw new \InvalidArgumentException(sprintf('Theme "%s" does not exist in class "%s".', $themeName, static::class));
- }
-
- $this->setStyles(static::$themes[$themeName]);
- }
-
- /**
- * Configures display options.
- *
- * @param array $displayOptions A map of display options to customize the behavior
- */
- public function setDisplayOptions(array $displayOptions)
- {
- $this->headerIsDumped = false;
- $this->displayOptions = $displayOptions + $this->displayOptions;
- }
-
/**
* Sets an HTML header that will be dumped once in the output stream.
*
- * @param string $header An HTML string
+ * @param string $header An HTML string.
*/
public function setDumpHeader($header)
{
@@ -127,8 +88,8 @@ class HtmlDumper extends CliDumper
/**
* Sets an HTML prefix and suffix that will encapse every single dump.
*
- * @param string $prefix The prepended HTML string
- * @param string $suffix The appended HTML string
+ * @param string $prefix The prepended HTML string.
+ * @param string $suffix The appended HTML string.
*/
public function setDumpBoundaries($prefix, $suffix)
{
@@ -139,13 +100,10 @@ class HtmlDumper extends CliDumper
/**
* {@inheritdoc}
*/
- public function dump(Data $data, $output = null, array $extraDisplayOptions = [])
+ public function dump(Data $data, $output = null)
{
- $this->extraDisplayOptions = $extraDisplayOptions;
- $result = parent::dump($data, $output);
+ parent::dump($data, $output);
$this->dumpId = 'sf-dump-'.mt_rand();
-
- return $result;
}
/**
@@ -153,13 +111,13 @@ class HtmlDumper extends CliDumper
*/
protected function getDumpHeader()
{
- $this->headerIsDumped = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
+ $this->headerIsDumped = true;
if (null !== $this->dumpHeader) {
return $this->dumpHeader;
}
- $line = str_replace('{$options}', json_encode($this->displayOptions, JSON_FORCE_OBJECT), <<<'EOHTML'
+ $line = <<<'EOHTML'
'.$this->dumpHeader;
}
- /**
- * {@inheritdoc}
- */
- public function dumpString(Cursor $cursor, $str, $bin, $cut)
- {
- if ('' === $str && isset($cursor->attr['img-data'], $cursor->attr['content-type'])) {
- $this->dumpKey($cursor);
- $this->line .= $this->style('default', $cursor->attr['img-size'] ?? '', []).' ';
- $this->endValue($cursor);
- $this->line .= $this->indentPad;
- $this->line .= sprintf('', $cursor->attr['content-type'], base64_encode($cursor->attr['img-data']));
- $this->endValue($cursor);
- } else {
- parent::dumpString($cursor, $str, $bin, $cut);
- }
- }
-
/**
* {@inheritdoc}
*/
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
{
- if (Cursor::HASH_OBJECT === $type) {
- $cursor->attr['depth'] = $cursor->depth;
- }
parent::enterHash($cursor, $type, $class, false);
- if ($cursor->skipChildren) {
- $cursor->skipChildren = false;
- $eol = ' class=sf-dump-compact>';
- } elseif ($this->expandNextHash) {
- $this->expandNextHash = false;
- $eol = ' class=sf-dump-expanded>';
- } else {
- $eol = '>';
- }
-
if ($hasChild) {
- $this->line .= 'refIndex) {
$r = Cursor::HASH_OBJECT !== $type ? 1 - (Cursor::HASH_RESOURCE !== $type) : 2;
$r .= $r && 0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->refIndex;
- $this->line .= sprintf(' id=%s-ref%s', $this->dumpId, $r);
+ $this->line .= sprintf('', $this->dumpId, $r);
+ } else {
+ $this->line .= '';
}
- $this->line .= $eol;
$this->dumpLine($cursor->depth);
}
}
@@ -864,13 +368,13 @@ EOHTML
/**
* {@inheritdoc}
*/
- protected function style($style, $value, $attr = [])
+ protected function style($style, $value, $attr = array())
{
if ('' === $value) {
return '';
}
- $v = esc($value);
+ $v = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
if ('ref' === $style) {
if (empty($attr['count'])) {
@@ -881,76 +385,41 @@ EOHTML
return sprintf('%s', $this->dumpId, $r, 1 + $attr['count'], $v);
}
- if ('const' === $style && isset($attr['value'])) {
- $style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
+ if ('const' === $style && array_key_exists('value', $attr)) {
+ $style .= sprintf(' title="%s"', htmlspecialchars(json_encode($attr['value']), ENT_QUOTES, 'UTF-8'));
} elseif ('public' === $style) {
$style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property');
} elseif ('str' === $style && 1 < $attr['length']) {
- $style .= sprintf(' title="%d%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
- } elseif ('note' === $style && 0 < ($attr['depth'] ?? 0) && false !== $c = strrpos($value, '\\')) {
- $style .= ' title=""';
- $attr += [
- 'ellipsis' => \strlen($value) - $c,
- 'ellipsis-type' => 'note',
- 'ellipsis-tail' => 1,
- ];
+ $style .= sprintf(' title="%s%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
+ } elseif ('note' === $style && false !== $c = strrpos($v, '\\')) {
+ return sprintf('%s', $v, $style, substr($v, $c + 1));
} elseif ('protected' === $style) {
$style .= ' title="Protected property"';
- } elseif ('meta' === $style && isset($attr['title'])) {
- $style .= sprintf(' title="%s"', esc($this->utf8Encode($attr['title'])));
} elseif ('private' === $style) {
- $style .= sprintf(' title="Private property defined in class:
`%s`"', esc($this->utf8Encode($attr['class'])));
+ $style .= sprintf(' title="Private property defined in class:
`%s`"', $attr['class']);
}
+
$map = static::$controlCharsMap;
-
- if (isset($attr['ellipsis'])) {
- $class = 'sf-dump-ellipsis';
- if (isset($attr['ellipsis-type'])) {
- $class = sprintf('"%s sf-dump-ellipsis-%s"', $class, $attr['ellipsis-type']);
- }
- $label = esc(substr($value, -$attr['ellipsis']));
- $style = str_replace(' title="', " title=\"$v\n", $style);
- $v = sprintf('%s', $class, substr($v, 0, -\strlen($label)));
-
- if (!empty($attr['ellipsis-tail'])) {
- $tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail'])));
- $v .= sprintf('%s%s', $class, substr($label, 0, $tail), substr($label, $tail));
- } else {
- $v .= $label;
- }
- }
-
- $v = "".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) {
- $s = $b = '";
+ $v = preg_replace_callback(static::$controlCharsRx, function ($c) use ($map, $style) {
+ $s = '';
$c = $c[$i = 0];
- if ($ns = "\r" === $c[$i] || "\n" === $c[$i]) {
- $s .= ' sf-dump-ns';
- }
- $s .= '">';
do {
- if (("\r" === $c[$i] || "\n" === $c[$i]) !== $ns) {
- $s .= ''.$b;
- if ($ns = !$ns) {
- $s .= ' sf-dump-ns';
- }
- $s .= '">';
- }
-
- $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
+ $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', ord($c[$i]));
} while (isset($c[++$i]));
- return $s.'';
- }, $v).'';
+ return $s.$style;
+ }, $v, -1, $cchrCount);
- if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
- $attr['href'] = $href;
+ if ($cchrCount && '<' === $v[0]) {
+ $v = substr($v, 7);
+ } else {
+ $v = $style.$v;
}
- if (isset($attr['href'])) {
- $target = isset($attr['file']) ? '' : ' target="_blank"';
- $v = sprintf('%s', esc($this->utf8Encode($attr['href'])), $target, $v);
- }
- if (isset($attr['lang'])) {
- $v = sprintf('
%s', esc($attr['lang']), $v);
+ if ($cchrCount && '>' === substr($v, -1)) {
+ $v = substr($v, 0, -strlen($style));
+ } else {
+ $v .= '';
}
return $v;
@@ -964,17 +433,12 @@ EOHTML
if (-1 === $this->lastDepth) {
$this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line;
}
- if ($this->headerIsDumped !== (null !== $this->outputStream ? $this->outputStream : $this->lineDumper)) {
+ if (!$this->headerIsDumped) {
$this->line = $this->getDumpHeader().$this->line;
}
if (-1 === $depth) {
- $args = ['"'.$this->dumpId.'"'];
- if ($this->extraDisplayOptions) {
- $args[] = json_encode($this->extraDisplayOptions, JSON_FORCE_OBJECT);
- }
- // Replace is for BC
- $this->line .= sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args));
+ $this->line .= sprintf($this->dumpSuffix, $this->dumpId);
}
$this->lastDepth = $depth;
@@ -985,20 +449,4 @@ EOHTML
}
AbstractDumper::dumpLine($depth);
}
-
- private function getSourceLink(string $file, int $line)
- {
- $options = $this->extraDisplayOptions + $this->displayOptions;
-
- if ($fmt = $options['fileLinkFormat']) {
- return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line);
- }
-
- return false;
- }
-}
-
-function esc($str)
-{
- return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
}
diff --git a/htdocs/includes/symfony/var-dumper/Dumper/ServerDumper.php b/htdocs/includes/symfony/var-dumper/Dumper/ServerDumper.php
deleted file mode 100644
index 94795bf6d69..00000000000
--- a/htdocs/includes/symfony/var-dumper/Dumper/ServerDumper.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\VarDumper\Dumper;
-
-use Symfony\Component\VarDumper\Cloner\Data;
-use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
-use Symfony\Component\VarDumper\Server\Connection;
-
-/**
- * ServerDumper forwards serialized Data clones to a server.
- *
- * @author Maxime Steinhausser