Skip to content

Commit 808698f

Browse files
Merge branch '2.8' into 3.0
* 2.8: [VarDumper] Fix tests on PHP 7 [DomCrawler] Clarify the value returned by getPhpFiles() [DependencyInjection] Fix #16461 Let Container::set() replace existing aliases avoid (string) catchable fatal error for instances of __PHP_Incomplete_Class remove unnecessary retrieval and setting of data Update validators.fr.xlf avoid (string) catchable fatal error for __PHP_Incomplete_Class instances sendContent return as parent. [DomCrawler] Remove the overridden getHash() method to prevent problems when cloning the crawler [FrameworkBundle] Fix a typo Added more exceptions to singularify method Add width attribute on SVG [FrameworkBundle] Support autowiring for TranslationInterface [WebProfiler] Fixed styles for search block and menu profiler for IE Edge Conflicts: src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php src/Symfony/Component/DomCrawler/Crawler.php
2 parents cc5bc89 + 1e1eece commit 808698f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

DataCollector/Util/ValueExporter.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public function exportValue($value, $depth = 1, $deep = false)
3535
return sprintf('Object(%s)', get_class($value));
3636
}
3737

38+
if ($value instanceof \__PHP_Incomplete_Class) {
39+
return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
40+
}
41+
3842
if (is_array($value)) {
3943
if (empty($value)) {
4044
return '[]';
@@ -75,4 +79,11 @@ public function exportValue($value, $depth = 1, $deep = false)
7579

7680
return (string) $value;
7781
}
82+
83+
private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
84+
{
85+
$array = new \ArrayObject($value);
86+
87+
return $array['__PHP_Incomplete_Class_Name'];
88+
}
7889
}

Tests/DataCollector/Util/ValueExporterTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ public function testDateTimeImmutable()
3636
$dateTime = new \DateTimeImmutable('2014-06-10 07:35:40', new \DateTimeZone('UTC'));
3737
$this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime));
3838
}
39+
40+
public function testIncompleteClass()
41+
{
42+
$foo = new \__PHP_Incomplete_Class();
43+
$array = new \ArrayObject($foo);
44+
$array['__PHP_Incomplete_Class_Name'] = 'AppBundle/Foo';
45+
$this->assertSame('__PHP_Incomplete_Class(AppBundle/Foo)', $this->valueExporter->exportValue($foo));
46+
}
3947
}

0 commit comments

Comments
 (0)