From fb18056924f6462ec55bbb5dba6a98f8b021be51 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 5 Sep 2014 12:27:47 +0200 Subject: [PATCH] validate `null` (Expression constraint in 2.6) Since Symfony 2.6, the Expression constraint doesn't skip validating `null` values. --- reference/constraints/Expression.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/reference/constraints/Expression.rst b/reference/constraints/Expression.rst index 68526372837..01eb69c3493 100644 --- a/reference/constraints/Expression.rst +++ b/reference/constraints/Expression.rst @@ -217,12 +217,11 @@ more about the expression language syntax, see // ... } - .. caution:: - - In Symfony 2.4 and Symfony 2.5, if the property (e.g. ``isTechnicalPost``) - were ``null``, the expression would never be called and the value - would be seen as valid. To ensure that the value is not ``null``, - use the :doc:`NotNull constraint `. + .. versionadded:: 2.6 + In Symfony 2.6, the Expression constraint *is* executed if the value + is ``null``. Before 2.6, if the value was ``null``, the expression + was never executed and the value was considered valid (unless you + also had a constraint like `NotBlank` on the property). For more information about the expression and what variables are available to you, see the :ref:`expression `