Created on 8 January 2024, 11 months ago
Updated 10 May 2024, 7 months ago

Problem/Motivation

Strangely on a project I did an upgrade on Drupal 10.2.0 and PHP 8.3, no problem and now I am upgrading my UI Suite contribution environment and I get some weird fatal errors, similar to 🐛 Fix TypeError: array_unshift(): Argument #1 ($array) must be of type array, null given in array_unshift() Caused by Deprecated Hooks in Drupal ~10.2.0 Needs work .

TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class "Drupal\ui_patterns_settings\Plugin\PatternSettingTypeBase" not found in call_user_func_array() (line 1013 of core/lib/Drupal/Core/Form/FormBuilder.php).
Drupal\Core\Form\FormBuilder->doBuildForm('user_login_form', Array, Object) (Line: 1076)
Drupal\Core\Form\FormBuilder->doBuildForm('user_login_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('user_login_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
...
Error: Class "Drupal\ui_patterns_settings\UiPatternsSettings" not found in ui_patterns_settings_entity_field_storage_info_alter() (line 148 of modules/contrib/ui_patterns_settings/ui_patterns_settings.module).
Drupal\Core\Extension\ModuleHandler->alter('entity_field_storage_info', Array, Object) (Line: 609)
Drupal\Core\Entity\EntityFieldManager->buildFieldStorageDefinitions('block_content') (Line: 466)
Drupal\Core\Entity\EntityFieldManager->getFieldStorageDefinitions('block_content') (Line: 122)
Drupal\views\EntityViewsData->getFieldStorageDefinitions() (Line: 438)
Drupal\views\EntityViewsData->mapFieldDefinition('block_content', 'uuid', Object, Object, Array) (Line: 333)
Drupal\views\EntityViewsData->getViewsData() (Line: 17)
Drupal\block_content\BlockContentViewsData->getViewsData() (Line: 180)
views_views_data() (Line: 228)
Drupal\views\ViewsData->Drupal\views\{closure}(Object, 'views') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('views_data', Object) (Line: 227)
Drupal\views\ViewsData->getData() (Line: 151)
Drupal\views\ViewsData->get('node_field_data') (Line: 85)
Drupal\views\Plugin\ViewsHandlerManager->getHandler(Array, NULL) (Line: 893)
Drupal\views\Plugin\views\display\DisplayPluginBase->getHandlers('sort') (Line: 1055)
Drupal\views\ViewExecutable->_initHandler('sort', Array) (Line: 913)
Drupal\views\ViewExecutable->initHandlers() (Line: 2323)
Drupal\views\Plugin\views\display\DisplayPluginBase->preExecute() (Line: 1707)
Drupal\views\ViewExecutable->preExecute(Array) (Line: 1642)
Drupal\views\ViewExecutable->executeDisplay('page_1', Array) (Line: 81)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 858)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 421)
...

I think this is due to an autoloading problem.

Edit: it was on my dev environment... I moved ui_patterns_settings from the custom to the contrib folder... Sorry for the noise, but the cleanup could still be useful :p

Proposed resolution

I propose to cleanup composer.json to ensure there is no side effects coming from it.

Similar to 📌 Code cleanup Fixed

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇫🇷France Grimreaper France 🇫🇷

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024