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

Commit 8ff4136

Browse filesBrowse files
bug #25848 [Validator] add missing parent isset and add test (Simperfit)
This PR was merged into the 2.7 branch. Discussion ---------- [Validator] add missing parent isset and add test | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #25843 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | This is a little PR to fix the error and to add the parent::__isset to the Constraints class, I'm adding a test too to be sure that this is not possible again. Btw, since this is instagihub, I'm coding at home and then I see a squirrel : ![img_3187 heic](https://user-images.githubusercontent.com/3451634/35149517-a9ddc0ba-fd16-11e7-9e22-cdba0b677071.jpeg) Commits ------- bcb79a3 [Validator] add missing parent isset and add test
2 parents 9312f79 + bcb79a3 commit 8ff4136
Copy full SHA for 8ff4136

File tree

2 files changed

+20
-0
lines changed
Filter options

2 files changed

+20
-0
lines changed

‎src/Symfony/Component/Validator/Constraint.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraint.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ public function __get($option)
214214
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option));
215215
}
216216

217+
/**
218+
* @param string $option The option name
219+
*
220+
* @return bool
221+
*/
222+
public function __isset($option)
223+
{
224+
return 'groups' === $option;
225+
}
226+
217227
/**
218228
* Adds the given group if this constraint is in the Default group.
219229
*

‎src/Symfony/Component/Validator/Tests/Constraints/FileTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ public function testMaxSize($maxSize, $bytes, $binaryFormat)
2626

2727
$this->assertSame($bytes, $file->maxSize);
2828
$this->assertSame($binaryFormat, $file->binaryFormat);
29+
$this->assertTrue($file->__isset('maxSize'));
30+
}
31+
32+
public function testMagicIsset()
33+
{
34+
$file = new File(array('maxSize' => 1));
35+
36+
$this->assertTrue($file->__isset('maxSize'));
37+
$this->assertTrue($file->__isset('groups'));
38+
$this->assertFalse($file->__isset('toto'));
2939
}
3040

3141
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.