Skip to content

Commit 8e13095

Browse files
committed
Fixed the unescaping of parameters to handle arrays
1 parent 045f936 commit 8e13095

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function resolve()
139139
foreach ($this->parameters as $key => $value) {
140140
try {
141141
$value = $this->resolveValue($value);
142-
$parameters[$key] = is_string($value) ? str_replace('%%', '%', $value) : $value;
142+
$parameters[$key] = $this->unescapeString($value);
143143
} catch (ParameterNotFoundException $e) {
144144
$e->setSourceKey($key);
145145

@@ -235,4 +235,22 @@ public function isResolved()
235235
{
236236
return $this->resolved;
237237
}
238+
239+
private function unescapeString($value)
240+
{
241+
if (is_string($value)) {
242+
return str_replace('%%', '%', $value);
243+
}
244+
245+
if (is_array($value)) {
246+
$result = array();
247+
foreach ($value as $k => $v) {
248+
$result[$k] = $this->unescapeString($v);
249+
}
250+
251+
return $result;
252+
}
253+
254+
return $value;
255+
}
238256
}

0 commit comments

Comments
 (0)