Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] add missing parent isset and add test #25848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions 10 src/Symfony/Component/Validator/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ public function __get($option)
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option));
}

/**
* @param string $option The option name
*
* @return bool
*/
public function __isset($option)
{
return 'groups' === $option;
}

/**
* Adds the given group if this constraint is in the Default group.
*
Expand Down
10 changes: 10 additions & 0 deletions 10 src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ public function testMaxSize($maxSize, $bytes, $binaryFormat)

$this->assertSame($bytes, $file->maxSize);
$this->assertSame($binaryFormat, $file->binaryFormat);
$this->assertTrue($file->__isset('maxSize'));
}

public function testMagicIsset()
{
$file = new File(array('maxSize' => 1));

$this->assertTrue($file->__isset('maxSize'));
$this->assertTrue($file->__isset('groups'));
$this->assertFalse($file->__isset('toto'));
}

/**
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.