diff --git a/src/Symfony/Component/Debug/Exception/FlattenException.php b/src/Symfony/Component/Debug/Exception/FlattenException.php index 33c9becf35f6f..b3a98ac0edc7b 100644 --- a/src/Symfony/Component/Debug/Exception/FlattenException.php +++ b/src/Symfony/Component/Debug/Exception/FlattenException.php @@ -263,7 +263,10 @@ private function flattenArgs($args, $level = 0, &$count = 0) if (++$count > 1e4) { return array('array', '*SKIPPED over 10000 entries*'); } - if (is_object($value)) { + if ($value instanceof \__PHP_Incomplete_Class) { + // is_object() returns false on PHP<=7.1 + $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); + } elseif (is_object($value)) { $result[$key] = array('object', get_class($value)); } elseif (is_array($value)) { if ($level > 10) { @@ -277,9 +280,6 @@ private function flattenArgs($args, $level = 0, &$count = 0) $result[$key] = array('boolean', $value); } elseif (is_resource($value)) { $result[$key] = array('resource', get_resource_type($value)); - } elseif ($value instanceof \__PHP_Incomplete_Class) { - // Special case of object, is_object will return false - $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); } else { $result[$key] = array('string', (string) $value); } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php index c9e51cc26ff12..09fe4e3312ceb 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php @@ -27,6 +27,10 @@ class ValueExporter */ public function exportValue($value, $depth = 1, $deep = false) { + if ($value instanceof \__PHP_Incomplete_Class) { + return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value)); + } + if (is_object($value)) { if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) { return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601)); @@ -35,10 +39,6 @@ public function exportValue($value, $depth = 1, $deep = false) return sprintf('Object(%s)', get_class($value)); } - if ($value instanceof \__PHP_Incomplete_Class) { - return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value)); - } - if (is_array($value)) { if (empty($value)) { return '[]'; diff --git a/src/Symfony/Component/VarDumper/Caster/CutStub.php b/src/Symfony/Component/VarDumper/Caster/CutStub.php index 244829c5ba545..26d11160afb47 100644 --- a/src/Symfony/Component/VarDumper/Caster/CutStub.php +++ b/src/Symfony/Component/VarDumper/Caster/CutStub.php @@ -39,9 +39,12 @@ public function __construct($value) case 'resource': case 'unknown type': + case 'resource (closed)': $this->type = self::TYPE_RESOURCE; $this->handle = (int) $value; - $this->class = @get_resource_type($value); + if ('Unknown' === $this->class = @get_resource_type($value)) { + $this->class = 'Closed'; + } $this->cut = -1; break; diff --git a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php index 90c2454e6654a..9b34198a41d8b 100644 --- a/src/Symfony/Component/VarDumper/Cloner/VarCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/VarCloner.php @@ -183,10 +183,13 @@ protected function doClone($var) case 'resource': case 'unknown type': + case 'resource (closed)': if (empty($resRefs[$h = (int) $v])) { $stub = new Stub(); $stub->type = Stub::TYPE_RESOURCE; - $stub->class = $zval['resource_type'] ?: get_resource_type($v); + if ('Unknown' === $stub->class = $zval['resource_type'] ?: @get_resource_type($v)) { + $stub->class = 'Closed'; + } $stub->value = $v; $stub->handle = $h; $a = $this->castResource($stub, 0 < $i); diff --git a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php index 4a719ca2a3751..cfbfa82684796 100644 --- a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php @@ -193,7 +193,7 @@ public function testClosedResource() $this->assertStringMatchesFormat( << pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy