From 122ccaa16bd363c2c2138417769f89e0c33d907f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Delhommeau Date: Thu, 1 Aug 2019 11:47:49 +0200 Subject: [PATCH] Remove strict true === $user['showEmail'] on preSubmit --- form/events.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/form/events.rst b/form/events.rst index f9a59c7cbee..fb74ee49e62 100644 --- a/form/events.rst +++ b/form/events.rst @@ -287,7 +287,7 @@ Creating and binding an event listener to the form:: // checks whether the user has chosen to display their email or not. // If the data was submitted previously, the additional value that is // included in the request variables needs to be removed. - if (true === $user['showEmail']) { + if (isset($user['showEmail']) && $user['showEmail']) { $form->add('email', EmailType::class); } else { unset($user['email']); @@ -383,7 +383,7 @@ Consider the following example of a form event subscriber:: // checks whether the user has chosen to display their email or not. // If the data was submitted previously, the additional value that // is included in the request variables needs to be removed. - if (true === $user['showEmail']) { + if (isset($user['showEmail']) && $user['showEmail']) { $form->add('email', EmailType::class); } else { unset($user['email']);