Skip to content

Commit ea068c2

Browse files
committed
feature symfony#4202 [Reference][Constraints] caution on null values in Expression constraint (xabbuh)
This PR was merged into the 2.4 branch. Discussion ---------- [Reference][Constraints] caution on `null` values in Expression constraint | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.4, 2.5 | Fixed tickets | part of symfony#4191 This adds a warning to the reference of the Expression constraint explaining that `null` values won't be validated in Symfony 2.4 and Symfony 2.5. Commits ------- 070489b caution on `null` values in Expression constraint
2 parents 4267086 + 070489b commit ea068c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

reference/constraints/Expression.rst

+7
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ 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>`.
226+
220227
For more information about the expression and what variables are available
221228
to you, see the :ref:`expression <reference-constraint-expression-option>`
222229
option details below.

0 commit comments

Comments
 (0)