diff --git a/UPGRADE-3.2.md b/UPGRADE-3.2.md
index 28c4eecf3c..b65bdd43fc 100644
--- a/UPGRADE-3.2.md
+++ b/UPGRADE-3.2.md
@@ -38,8 +38,14 @@ Form
FrameworkBundle
---------------
- * The service `serializer.mapping.cache.doctrine.apc` is deprecated. APCu should now
- be automatically used when available.
+ * The service `serializer.mapping.cache.doctrine.apc` is deprecated. APCu should now
+ be automatically used when available.
+
+HttpKernel
+----------
+
+ * `DataCollector::varToString()` is deprecated and will be removed in Symfony
+ 4.0. Use the `cloneVar()` method instead.
HttpFoundation
---------------
diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md
index f5a087ab67..42f709fe7c 100644
--- a/UPGRADE-4.0.md
+++ b/UPGRADE-4.0.md
@@ -155,6 +155,8 @@ HttpKernel
have your own `ControllerResolverInterface` implementation, you should
inject an `ArgumentResolverInterface` instance.
+ * The `DataCollector::varToString()` method has been removed in favor of `cloneVar()`.
+
Serializer
----------
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml
index 9c2dfad2ee..843fc72bdb 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml
@@ -24,6 +24,7 @@
User is not authenticated probably because they have no roles.
@@ -98,14 +98,14 @@ {% if collector.supportsRoleHierarchy %}- {{- trace.root -}} - {%- if trace.path is not empty -%} - {%- if trace.path|first != '[' %}.{% endif -%} - {{- trace.path -}} - {%- endif %} = {{ trace.value -}} -- {% elseif trace.message is defined %} - {{ trace.class }} -
{{ trace.message }}- {% else %} -
{{ trace }}- {% endif %} + {% if error.trace %} + Caused by: + {{ profiler_dump(error.trace, maxDepth=2) }} {% else %} Unknown. - {% endfor %} + {% endif %}
No GET parameters
No POST parameters
DumpDataCollectorTest.php on line {$line}: 123diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php index eef00d4a02..4fea364ec7 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php @@ -23,6 +23,8 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Cloner\VarCloner; class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase { @@ -30,8 +32,9 @@ class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase { $c = new RequestDataCollector(); - $c->collect($this->createRequest(), $this->createResponse()); + $c->collect($request = $this->createRequest(), $this->createResponse()); + $cloner = new VarCloner(); $attributes = $c->getRequestAttributes(); $this->assertSame('request', $c->getName()); @@ -42,12 +45,12 @@ class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestRequest()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag', $c->getRequestQuery()); $this->assertSame('html', $c->getFormat()); - $this->assertSame('foobar', $c->getRoute()); - $this->assertSame(array('name' => 'foo'), $c->getRouteParams()); + $this->assertEquals('foobar', $c->getRoute()); + $this->assertEquals($cloner->cloneVar(array('name' => 'foo')), $c->getRouteParams()); $this->assertSame(array(), $c->getSessionAttributes()); $this->assertSame('en', $c->getLocale()); - $this->assertRegExp('/Resource\(stream#\d+\)/', $attributes->get('resource')); - $this->assertSame('Object(stdClass)', $attributes->get('object')); + $this->assertEquals($cloner->cloneVar($request->attributes->get('resource')), $attributes->get('resource')); + $this->assertEquals($cloner->cloneVar($request->attributes->get('object')), $attributes->get('object')); $this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag', $c->getResponseHeaders()); $this->assertSame('OK', $c->getStatusText()); diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php index 09810a98b1..c583918f8c 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php @@ -13,6 +13,9 @@ namespace Symfony\Component\HttpKernel\Tests\DataCollector\Util; use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter; +/** + * @group legacy + */ class ValueExporterTest extends \PHPUnit_Framework_TestCase { /** diff --git a/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php b/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php index fe4f430777..45c6225bd8 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php @@ -16,6 +16,7 @@ use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage; use Symfony\Component\HttpKernel\Profiler\Profiler; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\VarDumper\Cloner\Data; class ProfilerTest extends \PHPUnit_Framework_TestCase { @@ -35,7 +36,7 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase $this->assertSame(204, $profile->getStatusCode()); $this->assertSame('GET', $profile->getMethod()); - $this->assertEquals(array('foo' => 'bar'), $profiler->get('request')->getRequestQuery()->all()); + $this->assertInstanceOf(Data::class, $profiler->get('request')->getRequestQuery()->all()['foo']); } public function testFindWorksWithDates() diff --git a/src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php index aa15443dd0..219ca7621a 100644 --- a/src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php +++ b/src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Security\Core\Authorization; -use Doctrine\Common\Util\ClassUtils; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; /** @@ -50,7 +49,7 @@ class DebugAccessDecisionManager implements AccessDecisionManagerInterface $this->decisionLog[] = array( 'attributes' => $attributes, - 'object' => $this->getStringRepresentation($object), + 'object' => $object, 'result' => $result, ); @@ -96,39 +95,4 @@ class DebugAccessDecisionManager implements AccessDecisionManagerInterface { return $this->decisionLog; } - - /** - * @param mixed $object - * - * @return string - */ - private function getStringRepresentation($object) - { - if (null === $object) { - return 'NULL'; - } - - if (!is_object($object)) { - if (is_bool($object)) { - return sprintf('%s (%s)', gettype($object), $object ? 'true' : 'false'); - } - if (is_scalar($object)) { - return sprintf('%s (%s)', gettype($object), $object); - } - - return gettype($object); - } - - $objectClass = class_exists('Doctrine\Common\Util\ClassUtils') ? ClassUtils::getClass($object) : get_class($object); - - if (method_exists($object, 'getId')) { - $objectAsString = sprintf('ID: %s', $object->getId()); - } elseif (method_exists($object, '__toString')) { - $objectAsString = (string) $object; - } else { - $objectAsString = sprintf('object hash: %s', spl_object_hash($object)); - } - - return sprintf('%s (%s)', $objectClass, $objectAsString); - } } diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/DebugAccessDecisionManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/DebugAccessDecisionManagerTest.php index f90f7769ba..16661f7022 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/DebugAccessDecisionManagerTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/DebugAccessDecisionManagerTest.php @@ -32,12 +32,12 @@ class DebugAccessDecisionManagerTest extends \PHPUnit_Framework_TestCase { $object = new \stdClass(); - yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'NULL', 'result' => false)), null); - yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'boolean (true)', 'result' => false)), true); - yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'string (jolie string)', 'result' => false)), 'jolie string'); - yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'integer (12345)', 'result' => false)), 12345); - yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'resource', 'result' => false)), fopen(__FILE__, 'r')); - yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'array', 'result' => false)), array()); - yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => sprintf('stdClass (object hash: %s)', spl_object_hash($object)), 'result' => false)), $object); + yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => null, 'result' => false)), null); + yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => true, 'result' => false)), true); + yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'jolie string', 'result' => false)), 'jolie string'); + yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 12345, 'result' => false)), 12345); + yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $x = fopen(__FILE__, 'r'), 'result' => false)), $x); + yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $x = array(), 'result' => false)), $x); + yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $object, 'result' => false)), $object); } } diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index a3a9e7d320..ad6fb2a21f 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -363,8 +363,7 @@ return function (root, x) { }; })(document); - -