Skip to content

Commit 3165e13

Browse files
Merge branch '3.2'
* 3.2: [WebProfilerBundle] Fix whitespace control in layout.html.twig [HttpKernel] Fix open_basedir compat in DataCollector [Validator] Fix init of YamlFileLoader::$classes for empty files
2 parents 726ad26 + c90dcdd commit 3165e13

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@
113113
<ul id="menu-profiler">
114114
{% for name, template in templates %}
115115
{% set menu -%}
116-
{% if block('menu', template) is defined %}
116+
{%- if block('menu', template) is defined -%}
117117
{% with { collector: profile.getcollector(name), profiler_markup_version: profiler_markup_version } %}
118118
{{- block('menu', template) -}}
119119
{% endwith %}
120-
{% endif %}
120+
{%- endif -%}
121121
{%- endset %}
122122
{% if menu is not empty %}
123123
<li class="{{ name }} {{ name == panel ? 'selected' : '' }}">

src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private function decorateVar($var)
135135
return self::$stubsCache[$var] = new ClassStub($var);
136136
}
137137
}
138-
if (false !== strpos($var, DIRECTORY_SEPARATOR) && false === strpos($var, '://') && false === strpos($var, "\0") && is_file($var)) {
138+
if (false !== strpos($var, DIRECTORY_SEPARATOR) && false === strpos($var, '://') && false === strpos($var, "\0") && @is_file($var)) {
139139
return self::$stubsCache[$var] = new LinkStub($var);
140140
}
141141
}

src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected function parseNodes(array $nodes)
107107
*
108108
* @param string $path The path of the YAML file
109109
*
110-
* @return array|null The class descriptions or null, if the file was empty
110+
* @return array The class descriptions
111111
*
112112
* @throws \InvalidArgumentException If the file could not be loaded or did
113113
* not contain a YAML array
@@ -122,7 +122,7 @@ private function parseFile($path)
122122

123123
// empty file
124124
if (null === $classes) {
125-
return;
125+
return array();
126126
}
127127

128128
// not an array
@@ -139,13 +139,7 @@ private function loadClassesFromYaml()
139139
$this->yamlParser = new YamlParser();
140140
}
141141

142-
// This method may throw an exception. Do not modify the class'
143-
// state before it completes
144-
if (false === ($classes = $this->parseFile($this->file))) {
145-
return;
146-
}
147-
148-
$this->classes = $classes;
142+
$this->classes = $this->parseFile($this->file);
149143

150144
if (isset($this->classes['namespaces'])) {
151145
foreach ($this->classes['namespaces'] as $alias => $namespace) {

src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public function testLoadClassMetadataReturnsFalseIfEmpty()
3131
$metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity');
3232

3333
$this->assertFalse($loader->loadClassMetadata($metadata));
34+
35+
$r = new \ReflectionProperty($loader, 'classes');
36+
$r->setAccessible(true);
37+
$this->assertSame(array(), $r->getValue($loader));
3438
}
3539

3640
/**

0 commit comments

Comments
 (0)