File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ Creating and binding an event listener to the form::
287
287
// checks whether the user has chosen to display their email or not.
288
288
// If the data was submitted previously, the additional value that is
289
289
// included in the request variables needs to be removed.
290
- if (true === $user['showEmail']) {
290
+ if (isset($user['showEmail']) && $user['showEmail']) {
291
291
$form->add('email', EmailType::class);
292
292
} else {
293
293
unset($user['email']);
@@ -383,7 +383,7 @@ Consider the following example of a form event subscriber::
383
383
// checks whether the user has chosen to display their email or not.
384
384
// If the data was submitted previously, the additional value that
385
385
// is included in the request variables needs to be removed.
386
- if (true === $user['showEmail']) {
386
+ if (isset($user['showEmail']) && $user['showEmail']) {
387
387
$form->add('email', EmailType::class);
388
388
} else {
389
389
unset($user['email']);
You can’t perform that action at this time.
0 commit comments