This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/UPGRADE-2.6.md
Tom Corrigan 580e1a7b46 [Validator] fixed: Expressions always valid for null values
The ExpressionValidator was incorrectly skipping validation of null or
empty string values.
2014-08-21 16:49:24 +10:00

31 lines
891 B
Markdown

UPGRADE FROM 2.5 to 2.6
=======================
Validator
---------
* The internal method `setConstraint()` was added to
`Symfony\Component\Validator\Context\ExecutionContextInterface`. With
this method, the context is informed about the constraint that is currently
being validated.
If you implement this interface, make sure to add the method to your
implementation. The easiest solution is to just implement an empty method:
```php
public function setConstraint(Constraint $constraint)
{
}
```
* Prior to 2.6 `Symfony\Component\Validator\Constraints\ExpressionValidator`
would not execute the Expression if it was attached to a property on an
object and that property was set to `null` or an empty string.
To emulate the old behaviour change your expression to something like
this:
```
value == null or (YOUR_EXPRESSION)
```