Problem/Motivation
PHP Warning error message when saving module's settings form at /admin/config/system/browser-update:
Warning : Undefined array key "mobile" dans Drupal\bu\Form\SettingsForm->submitForm() (line 232 in /var/www/html/web/modules/contrib/bu/src/Form/SettingsForm.php). =>
array:23 [▼
"22: Drupal\bu\Form\SettingsForm->submitForm()" => array:2 [▶]
"21: call_user_func_array()" => array:1 [▶]
"20: Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()" => array:2 [▶]
"19: Drupal\Core\Form\FormSubmitter->doSubmitForm()" => array:2 [▶]
"18: Drupal\Core\Form\FormBuilder->processForm()" => array:2 [▶]
"17: Drupal\Core\Form\FormBuilder->buildForm()" => array:2 [▶]
"16: Drupal\Core\Controller\FormController->getContentResult()" => array:2 [▶]
"15: call_user_func_array()" => array:1 [▶]
"14: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()" => array:1 [▶]
"13: Drupal\Core\Render\Renderer->executeInRenderContext()" => array:2 [▶]
"12: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()" => array:2 [▶]
"11: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()" => array:1 [▶]
"10: Symfony\Component\HttpKernel\HttpKernel->handleRaw()" => array:2 [▶]
"\u{A0}9: Symfony\Component\HttpKernel\HttpKernel->handle()" => array:2 [▶]
"\u{A0}8: Drupal\Core\StackMiddleware\Session->handle()" => array:2 [▶]
"\u{A0}7: Drupal\Core\StackMiddleware\KernelPreHandle->handle()" => array:2 [▶]
"\u{A0}6: Drupal\page_cache\StackMiddleware\PageCache->pass()" => array:2 [▶]
"\u{A0}5: Drupal\page_cache\StackMiddleware\PageCache->handle()" => array:2 [▶]
"\u{A0}4: Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()" => array:2 [▶]
"\u{A0}3: Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()" => array:2 [▶]
"\u{A0}2: Drupal\Core\StackMiddleware\StackedHttpKernel->handle()" => array:2 [▶]
"\u{A0}1: Drupal\Core\DrupalKernel->handle()" => array:2 [▶]
"\u{A0}0: main()" => array:2 [▶]
Corresponding to undefined 'mobile' key here:
https://git.drupalcode.org/project/bu/-/blob/2.1.1/src/Form/SettingsForm...
Since the field doesn't exist in the form, it couldn't be submitted and therefore isn't present in form values array.
Steps to reproduce
- Go to module's admin settings page at :
/admin/config/system/browser-update. - Save the page by clicking on the "Save"/"Submit" button at the bottom of the form page.
- See the error message, either in the logs or on the page if errors are displayed.
Proposed resolution
This issue seems to be due to a missing field on the configuration page: 'mobile', which seems to be defined everywhere but in the form:
- Probably missing from here: https://git.drupalcode.org/project/bu/-/blob/2.1.1/src/Form/SettingsForm...
- Defined here: https://git.drupalcode.org/project/bu/-/blob/2.1.1/config/schema/bu.sche...
- Saved here: https://git.drupalcode.org/project/bu/-/blob/2.1.1/src/Form/SettingsForm...
Which prompts the error.
According to the documentation at: http://browser-update.org/customize.html
The option mobile doesn't seem to exist anymore, therefore, the simplest solution would be to remove it from the files where it is currently defined and used.
Additionally: Evaluate the use of other properties passed in module's JS file:
https://git.drupalcode.org/project/bu/-/blob/2.1.1/js/bu.js?ref_type=tag...
For example: insecure and unsupported also don't seem to be options that could be passed to browserUpdate JS, see: http://browser-update.org/customize.html
(All other options seem to be supported though)
Any feedback, patches, questions, comments, suggestions or comments would be greatly appreciated.
Feel free to let us know if you have any questions or would need additional information on this ticket, we would surely be glad to help.
Thanks in advance!
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | bu_mobile-3389312.patch | 630 bytes | sarwan_verma |
Issue fork bu-3389312
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dydave commentedComment #3
sarwan_verma commentedHi @DYdave,
I have fixed the Settings issue form: Fix PHP Warning : Undefined array key 'mobile' and also attached patch,
please review and verify.
Comment #4
sarwan_verma commentedComment #5
zarpele commentedHey @sarwan_verma, no need to make too much sense to add the element in the form without any implementation.
As per @dydave, I second that to remove any mobile occurrence since it is not being defined here https://browser-update.org/customize.html