Call to a member function toUrl() on null, on line 401

Created on 27 October 2020, over 3 years ago
Updated 12 February 2024, 4 months ago

Problem/Motivation

Upon logging in, I expected to have access to the site, and the ability to manage its configuration and add new content.

Instead, I see a white-screen-o-death and in the browser, the error message:
"The website encountered an unexpected error. Please try again later."

I then see these entries in the error log.
[Mon Oct 26 12:25:33.656979 2020] [proxy_fcgi:error] [pid 35690:tid 139862858528512] [client 172.17.0.4:48496]
AH01071: Got error 'PHP message: Error: Call to a member function toUrl() on null in
/opt/local/jf4ga/drupal/web/core/modules/shortcut/shortcut.module on line 401
#0 [internal function]: shortcut_toolbar()\n
#1 /opt/local/jf4ga/drupal/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('shortcut_toolba...', Array)\n
#2 /opt/local/jf4ga/drupal/web/core/modules/toolbar/src/Element/Toolbar.php(81): Drupal\\Core\\Extension\\ModuleHandler->invokeAll('toolbar')\n
#3 [internal function]: Drupal\\toolbar\\Element\\Toolbar::preRenderToolbar(Array)\n
#4 /opt/local/jf4ga/drupal/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(100): call_user_func_array(Array, Array)\n
#5 /opt/local/jf4ga/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(781): Drupal\\Core\\Render\\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'silenced_deprec...', 'Drupal\\\\Core\\\\Ren...')\n
#6 /opt/local/jf4ga/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(372): Drupal\\Core\\Render\\Renderer->doCallback('#pre_render', Ar...'

Steps to reproduce

I have a fresh rebuild using composer of the site installation, with a restoration of the production database;
its comes up without issue.

drupal/core: ^8.8.0
yields an 8.9.7 installation

I run `drush cr`

Running `drush updb` reports
[success] No pending updates.

(I seem to recall that running a database update is a part of my deployment pipeline)

and harvest a one-time login with `drush uli`

when I use that link to log in, I am met with a WSOD, and this message:
"The website encountered an unexpected error. Please try again later."

Results do not change using a password reset token sent by /user/password form.

Proposed resolution

#php irc channel suggested, upon review of my issue report here:
https://gist.github.com/hesco/1f49662ce69e760e29ae35304ecedc1d

that this was a bug in the shortcut.module
I am not familiar enough with drupal core to suggest a resolution

I have now locked down the version to 8.8.5 (the version running on the production site), and am building another test installation, to see if my new modules play well with the previous version of core. If this works (after completing the tasks which it distracted me from), I will, isA, run some repeated builds to bisect the version between 8.8.5 and 8.9.7 to see if I can narrow down where this issue may have been introduced, or if it relates to one of the new modules I have added. Those modules include:

"drupal/google_analytics": "^3.1",
"drupal/facebook_pixel": "^1.0@alpha",
"drupal/header_and_footer_scripts": "^2.2",
"drupal/tasty_backend": "^1.0@beta",

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Closed: outdated

Version

9.3

Component
Shortcut 

Last updated about 1 month ago

Created by

🇺🇸United States hesco

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024