From 073a1dae1318519066ca9fb0d2dc53392ac5fbca Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 8 Dec 2016 13:07:24 +0100 Subject: [PATCH 1/3] [Validator] Fix init of YamlFileLoader::$classes for empty files --- .../Validator/Mapping/Loader/YamlFileLoader.php | 12 +++--------- .../Tests/Mapping/Loader/YamlFileLoaderTest.php | 4 ++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php index cf6dd92dca..16212833dc 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php @@ -46,13 +46,7 @@ class YamlFileLoader extends FileLoader $this->yamlParser = new YamlParser(); } - // This method may throw an exception. Do not modify the class' - // state before it completes - if (false === ($classes = $this->parseFile($this->file))) { - return false; - } - - $this->classes = $classes; + $this->classes = $this->parseFile($this->file); if (isset($this->classes['namespaces'])) { foreach ($this->classes['namespaces'] as $alias => $namespace) { @@ -111,7 +105,7 @@ class YamlFileLoader extends FileLoader * * @param string $path The path of the YAML file * - * @return array|null The class descriptions or null, if the file was empty + * @return array The class descriptions * * @throws \InvalidArgumentException If the file could not be loaded or did * not contain a YAML array @@ -126,7 +120,7 @@ class YamlFileLoader extends FileLoader // empty file if (null === $classes) { - return; + return array(); } // not an array diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php index 2ca64122aa..15f02139ae 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php @@ -31,6 +31,10 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); $this->assertFalse($loader->loadClassMetadata($metadata)); + + $r = new \ReflectionProperty($loader, 'classes'); + $r->setAccessible(true); + $this->assertSame(array(), $r->getValue($loader)); } /** From 84ad8ebe3897b47aec4292431b74b0cbba0593d0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 8 Dec 2016 16:45:56 +0100 Subject: [PATCH 2/3] [HttpKernel] Fix open_basedir compat in DataCollector --- .../Component/HttpKernel/DataCollector/DataCollector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index 9674e08bbb..7d35996e1b 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -135,7 +135,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable return self::$stubsCache[$var] = new ClassStub($var); } } - if (false !== strpos($var, DIRECTORY_SEPARATOR) && false === strpos($var, '://') && false === strpos($var, "\0") && is_file($var)) { + if (false !== strpos($var, DIRECTORY_SEPARATOR) && false === strpos($var, '://') && false === strpos($var, "\0") && @is_file($var)) { return self::$stubsCache[$var] = new LinkStub($var); } } From d052fa933c42c8f0a44efdebe41f9c9f4a48e55f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 8 Dec 2016 16:37:50 +0100 Subject: [PATCH 3/3] [WebProfilerBundle] Fix whitespace control in layout.html.twig --- .../Resources/views/Profiler/layout.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig index 37be3ab98d..101a494e0a 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig @@ -37,11 +37,11 @@