February 1, 2019 Javier Eguiluz

The NotBlank constraint of the Validator component checks that a value is not false , null , an empty array or an empty string. Most of the other constraints ignore null values, but NotBlank validates them. This causes issues in scenarios such as APIs called from front-end code, where is easier to include null fields instead of removing those fields when making requests.

In Symfony 4.3 we've improved the NotBlank constraint adding a new allowNull option to it. By default this option is false , to keep the current behavior. If you set it to true , then null values will be considered valid instead of triggering a constraint violation: