Skip to content

Commit fb18056

Browse files
committed
validate null (Expression constraint in 2.6)
Since Symfony 2.6, the Expression constraint doesn't skip validating `null` values.
1 parent 4198889 commit fb18056

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

reference/constraints/Expression.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,11 @@ more about the expression language syntax, see
217217
// ...
218218
}
219219
220-
.. caution::
221-
222-
In Symfony 2.4 and Symfony 2.5, if the property (e.g. ``isTechnicalPost``)
223-
were ``null``, the expression would never be called and the value
224-
would be seen as valid. To ensure that the value is not ``null``,
225-
use the :doc:`NotNull constraint </reference/constraints/NotNull>`.
220+
.. versionadded:: 2.6
221+
In Symfony 2.6, the Expression constraint *is* executed if the value
222+
is ``null``. Before 2.6, if the value was ``null``, the expression
223+
was never executed and the value was considered valid (unless you
224+
also had a constraint like `NotBlank` on the property).
226225

227226
For more information about the expression and what variables are available
228227
to you, see the :ref:`expression <reference-constraint-expression-option>`

0 commit comments

Comments
 (0)