Skip to content

Commit

Permalink
[Form] removed a constraint in PropertyPath as the path can definitel…
Browse files Browse the repository at this point in the history
…y be an empty string for errors attached on the main form (when using a constraint defined with the 'validation_constraint' option)
  • Loading branch information
fabpot committed Jul 15, 2011
1 parent c045120 commit 5182a0c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Util/PropertyPath.php
Expand Up @@ -55,7 +55,7 @@ class PropertyPath implements \IteratorAggregate
*/
public function __construct($propertyPath)
{
if ('' === $propertyPath || null === $propertyPath) {
if (null === $propertyPath) {
throw new InvalidPropertyPathException('The property path must not be empty');
}

Expand Down
7 changes: 0 additions & 7 deletions tests/Symfony/Tests/Component/Form/PropertyPathTest.php
Expand Up @@ -385,13 +385,6 @@ public function testInvalidPropertyPath_unexpectedCharacters()
new PropertyPath('property.$form');
}

public function testInvalidPropertyPath_empty()
{
$this->setExpectedException('Symfony\Component\Form\Exception\InvalidPropertyPathException');

new PropertyPath('');
}

public function testInvalidPropertyPath_null()
{
$this->setExpectedException('Symfony\Component\Form\Exception\InvalidPropertyPathException');
Expand Down

1 comment on commit 5182a0c

@webmozart
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, the assumption taken here is wrong and I'm going to revert the commit. The property path must never accept an empty value. If an error is mapped to an empty path, no PropertyPath instance should be created.

Please sign in to comment.