No more exception for malformed input name

This commit is contained in:
guiled 2016-04-17 00:19:05 +02:00 committed by Fabien Potencier
parent a0cdcb0ffb
commit 953a3835a2
1 changed files with 4 additions and 3 deletions

View File

@ -207,16 +207,17 @@ class FormFieldRegistry
if (preg_match('/^(?P<base>[^[]+)(?P<extra>(\[.*)|$)/', $name, $m)) {
$segments = array($m['base']);
while (!empty($m['extra'])) {
if (preg_match('/^\[(?P<segment>.*?)\](?P<extra>.*)$/', $m['extra'], $m)) {
$extra = $m['extra'];
if (preg_match('/^\[(?P<segment>.*?)\](?P<extra>.*)$/', $extra, $m)) {
$segments[] = $m['segment'];
} else {
throw new \InvalidArgumentException(sprintf('Malformed field path "%s"', $name));
$segments[] = $extra;
}
}
return $segments;
}
throw new \InvalidArgumentException(sprintf('Malformed field path "%s"', $name));
return [$name];
}
}