8000 Remove strict true === $user['showEmail'] on preSubmit · xavierleune/symfony-docs@122ccaa · GitHub
[go: up one dir, main page]

Skip to content

Commit 122ccaa

Browse files
jbdelhommeauOskarStark
authored andcommitted
Remove strict true === $user['showEmail'] on preSubmit
1 parent eebc2e4 commit 122ccaa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

form/events.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ Creating and binding an event listener to the form::
287287
// checks whether the user has chosen to display their email or not.
288288
// If the data was submitted previously, the additional value that is
289289
// included in the request variables needs to be removed.
290-
if (true === $user['showEmail']) {
290+
if (isset($user['showEmail']) && $user['showEmail']) {
291291
$form->add('email', EmailType::class);
292292
} else {
293293
unset($user['email']);
@@ -383,7 +383,7 @@ Consider the following example of a form event subscriber::
383383
// checks whether the user has chosen to display their email or not.
384384
// If the data was submitted previously, the additional value that
385385
// is included in the request variables needs to be removed.
386-
if (true === $user['showEmail']) {
386+
if (isset($user['showEmail']) && $user['showEmail']) {
387387
$form->add('email', EmailType::class);
388388
} else {
389389
unset($user['email']);

0 commit comments

Comments
 (0)
0