I encounter the following stack trace when I am logged in as UID 0 and trying to check /search/node . However when I am anonymous user, it does not do this.
I would assume this is due to some other customization on my site. If I can isolate further, will share here.
[Mon Mar 12 15:02:48.725864 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP Fatal error: "0" is an invalid render array key in /web/core/lib/Drupal/Core/Render/Element.php on line 97
[Mon Mar 12 15:02:48.725904 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP Stack trace:
[Mon Mar 12 15:02:48.725915 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 1. {main}() /web/index.php:0
[Mon Mar 12 15:02:48.725922 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 2. Drupal\\Core\\DrupalKernel->handle() /web/index.php:19
[Mon Mar 12 15:02:48.725928 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 3. Stack\\StackedHttpKernel->handle() /web/core/lib/Drupal/Core/DrupalKernel.php:657
[Mon Mar 12 15:02:48.725960 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 4. Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle() /vendor/stack/builder/src/Stack/StackedHttpKernel.php:23
[Mon Mar 12 15:02:48.725967 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 5. Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle() /web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php:50
[Mon Mar 12 15:02:48.725973 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 6. Drupal\\page_cache\\StackMiddleware\\PageCache->handle() /web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php:47
[Mon Mar 12 15:02:48.725979 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 7. Drupal\\page_cache\\StackMiddleware\\PageCache->pass() /web/core/modules/page_cache/src/StackMiddleware/PageCache.php:78
[Mon Mar 12 15:02:48.726005 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 8. Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle() /web/core/modules/page_cache/src/StackMiddleware/PageCache.php:99
[Mon Mar 12 15:02:48.726033 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 9. Drupal\\Core\\StackMiddleware\\Session->handle() /web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php:47
[Mon Mar 12 15:02:48.726040 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 10. Symfony\\Component\\HttpKernel\\HttpKernel->handle() /web/core/lib/Drupal/Core/StackMiddleware/Session.php:57
[Mon Mar 12 15:02:48.726045 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 11. Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw() /vendor/symfony/http-kernel/HttpKernel.php:68
[Mon Mar 12 15:02:48.726054 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 12. call_user_func_array:{/vendor/symfony/http-kernel/HttpKernel.php:153}() /vendor/symfony/http-kernel/HttpKernel.php:153
[Mon Mar 12 15:02:48.726062 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 13. Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() /vendor/symfony/http-kernel/HttpKernel.php:153
[Mon Mar 12 15:02:48.726069 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 14. Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:97
[Mon Mar 12 15:02:48.726077 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 15. Drupal\\Core\\Render\\Renderer->executeInRenderContext() /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:124
[Mon Mar 12 15:02:48.726083 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 16. Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() /web/core/lib/Drupal/Core/Render/Renderer.php:582
[Mon Mar 12 15:02:48.726092 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 17. call_user_func_array:{/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123}() /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123
[Mon Mar 12 15:02:48.726100 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 18. Drupal\\search\\Controller\\SearchController->view() /web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:123
[Mon Mar 12 15:02:48.726108 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 19. Drupal\\Core\\Form\\FormBuilder->getForm() /web/core/modules/search/src/Controller/SearchController.php:88
[Mon Mar 12 15:02:48.726213 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 20. Drupal\\Core\\Form\\FormBuilder->buildForm() /web/core/lib/Drupal/Core/Form/FormBuilder.php:212
[Mon Mar 12 15:02:48.726326 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 21. Drupal\\Core\\Form\\FormBuilder->prepareForm() /web/core/lib/Drupal/Core/Form/FormBuilder.php:272
[Mon Mar 12 15:02:48.726375 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 22. Drupal\\Core\\Extension\\ModuleHandler->alter() /web/core/lib/Drupal/Core/Form/FormBuilder.php:830
[Mon Mar 12 15:02:48.726423 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 23. themable_forms_form_alter() /web/core/lib/Drupal/Core/Extension/ModuleHandler.php:501
[Mon Mar 12 15:02:48.726466 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 24. themable_forms_attach_form_id() /web/modules/contrib/themable_forms/themable_forms.module:62
[Mon Mar 12 15:02:48.726502 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 25. themable_forms_attach_form_id() /web/modules/contrib/themable_forms/themable_forms.module:80
[Mon Mar 12 15:02:48.726521 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 26. themable_forms_attach_form_id() /web/modules/contrib/themable_forms/themable_forms.module:80
[Mon Mar 12 15:02:48.726541 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 27. themable_forms_attach_form_id() /web/modules/contrib/themable_forms/themable_forms.module:80
[Mon Mar 12 15:02:48.726564 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 28. Drupal\\Core\\Render\\Element::children() /web/modules/contrib/themable_forms/themable_forms.module:76
[Mon Mar 12 15:02:48.726589 2018] [php7:notice] [pid 27054] [client 10.12.80.159:61040] PHP 29. trigger_error() /web/core/lib/Drupal/Core/Render/Element.php:97
Based on these lines it involves the interesting recursive function here:
function themable_forms_attach_form_id(&$form, $form_id) {
foreach (Element::children($form) as $child) {
if (!isset($form[$child]['#form_id'])) {
$form[$child]['#form_id'] = $form_id;
}
themable_forms_attach_form_id($form[$child], $form_id);
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2952367-9-configurable-block-error.patch | 4.34 KB | hongpong |
| #10 | 2952367-8-configurable-block-error.patch | 4.37 KB | hongpong |
Comments
Comment #2
hongpong commentedComment #3
hongpong commentedI also tried applying #2903660: Undefined index: #type in themable_forms_theme_suggestions_form_element() and that did not affect the issue.
Comment #4
hongpong commentedSorry this error is reproducible without the module being enabled - i am closing with 'works as designed'.
Comment #5
hongpong commentedAh the issue is actually with better_search module. When themable_forms is disabled and better_search is enabled, at /search/node with Bartik I get:
Comment #6
hongpong commentedI think the problem is at:
$form['basic']['submit'] = ['class' => ['visually-hidden']];This probably blows away the form. via
var_dump($form['basic']['submit'])I get:array (size=2) '#type' => string 'submit' (length=6) '#value' => object(Drupal\Core\StringTranslation\TranslatableMarkup)[511] protected 'string' => string 'Search' (length=6) protected 'translatedMarkup' => null protected 'options' => array (size=0) empty protected 'stringTranslation' => object(Drupal\Core\StringTranslation\TranslationManager)[296] protected 'translators' => array (size=1) ... protected 'sortedTranslators' => null protected 'defaultLangcode' => string 'en' (length=2) public '_serviceId' => string 'string_translation' (length=18) protected 'arguments' => array (size=0) emptyComment #7
3cwebdev commentedComment #8
hongpong commentedHi,
Here this adds two configuration options, to allow us to shut off the alteration of search pages. It also adds configuration toggle for 'visually hidden' and makes it so that statement doesn't give a fatal error. There is also an upgrade .install added, so that the current behavior is preserved, but now made configurable. Not too bad. I tested it and it seems to work as expected. Best regards!
.. edit - patch generating problem, one moment please
Comment #9
3cwebdev commentedHi HongPong,
The patch you attached is empty.
Comment #10
hongpong commentedfixed patch sorry!
Comment #11
hongpong commentednewline was missing on install file. this should add that
Comment #12
yogeshmpawarchecking this issue.
Comment #14
yogeshmpawarLooks good to me so committed & pushed to 8.x-1.x branch.
Thanks @HongPong for pointing this issue & working on patch.
Comment #15
yogeshmpawarComment #17
ddhuri commentedThanks HongPong,
Patch #11 Works for me.