Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 589b1d4

Browse filesBrowse files
bug #19702 [Debug][HttpKernel][VarDumper] Prepare for committed 7.2 changes (aka "small-bc-breaks") (nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- [Debug][HttpKernel][VarDumper] Prepare for committed 7.2 changes (aka "small-bc-breaks") | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | Tests pass? | yes | License | MIT On PHP 7.2: - `is_object()` is going to return `true` for `__PHP_Incomplete_Class` instances - `gettype($closed_resource);` returns "resource (closed)" ping @nikic FYI see https://travis-ci.org/symfony/symfony/jobs/154114269 for fixed tests (except the one on ClassLoader which is a BC break on 7.1 that should be fixed there IMHO). Commits ------- feb2cd0 [Debug][HttpKernel][VarDumper] Prepare for committed 7.2 changes
2 parents 005d180 + feb2cd0 commit 589b1d4
Copy full SHA for 589b1d4

File tree

5 files changed

+17
-11
lines changed
Filter options

5 files changed

+17
-11
lines changed

‎src/Symfony/Component/Debug/Exception/FlattenException.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Exception/FlattenException.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ private function flattenArgs($args, $level = 0, &$count = 0)
263263
if (++$count > 1e4) {
264264
return array('array', '*SKIPPED over 10000 entries*');
265265
}
266-
if (is_object($value)) {
266+
if ($value instanceof \__PHP_Incomplete_Class) {
267+
// is_object() returns false on PHP<=7.1
268+
$result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
269+
} elseif (is_object($value)) {
267270
$result[$key] = array('object', get_class($value));
268271
} elseif (is_array($value)) {
269272
if ($level > 10) {
@@ -277,9 +280,6 @@ private function flattenArgs($args, $level = 0, &$count = 0)
277280
$result[$key] = array('boolean', $value);
278281
} elseif (is_resource($value)) {
279282
$result[$key] = array('resource', get_resource_type($value));
280-
} elseif ($value instanceof \__PHP_Incomplete_Class) {
281-
// Special case of object, is_object will return false
282-
$result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
283283
} else {
284284
$result[$key] = array('string', (string) $value);
285285
}

‎src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class ValueExporter
2727
*/
2828
public function exportValue($value, $depth = 1, $deep = false)
2929
{
30+
if ($value instanceof \__PHP_Incomplete_Class) {
31+
return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
32+
}
33+
3034
if (is_object($value)) {
3135
if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) {
3236
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601));
@@ -35,10 +39,6 @@ public function exportValue($value, $depth = 1, $deep = false)
3539
return sprintf('Object(%s)', get_class($value));
3640
}
3741

38-
if ($value instanceof \__PHP_Incomplete_Class) {
39-
return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
40-
}
41-
4242
if (is_array($value)) {
4343
if (empty($value)) {
4444
return '[]';

‎src/Symfony/Component/VarDumper/Caster/CutStub.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/CutStub.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ public function __construct($value)
3939

4040
case 'resource':
4141
case 'unknown type':
42+
case 'resource (closed)':
4243
$this->type = self::TYPE_RESOURCE;
4344
$this->handle = (int) $value;
44-
$this->class = @get_resource_type($value);
45+
if ('Unknown' === $this->class = @get_resource_type($value)) {
46+
$this->class = 'Closed';
47+
}
4548
$this->cut = -1;
4649
break;
4750

‎src/Symfony/Component/VarDumper/Cloner/VarCloner.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Cloner/VarCloner.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,13 @@ protected function doClone($var)
183183

184184
case 'resource':
185185
case 'unknown type':
186+
case 'resource (closed)':
186187
if (empty($resRefs[$h = (int) $v])) {
187188
$stub = new Stub();
188189
$stub->type = Stub::TYPE_RESOURCE;
189-
$stub->class = $zval['resource_type'] ?: get_resource_type($v);
190+
if ('Unknown' === $stub->class = $zval['resource_type'] ?: @get_resource_type($v)) {
191+
$stub->class = 'Closed';
192+
}
190193
$stub->value = $v;
191194
$stub->handle = $h;
192195
$a = $this->castResource($stub, 0 < $i);

‎src/Symfony/Component/VarDumper/Tests/CliDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/CliDumperTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function testClosedResource()
193193

194194
$this->assertStringMatchesFormat(
195195
<<<EOTXT
196-
Unknown resource @{$res}
196+
Closed resource @{$res}
197197
198198
EOTXT
199199
,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.