Last active
October 27, 2020 04:37
-
-
Save hesco/1f49662ce69e760e29ae35304ecedc1d to your computer and use it in GitHub Desktop.
What means this error, pray tell.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have a fresh rebuild of my site, with a restoration of the production website; | |
its comes up without issue. | |
I run `drush cr` | |
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." | |
I then see these entries in the error log. | |
What am I over looking and how might I resolve it, please? | |
This is happening for the uid#1 user on login, and regardless of what url is visited. | |
It does not impact an anonyous user in a private session. | |
----- | |
[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...' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- shortcut/shortcut.module on line 401 | |
/** | |
* Returns the current displayed shortcut set for the provided user account. | |
* | |
* @param $account | |
* (optional) The user account whose shortcuts will be returned. Defaults to | |
* the currently logged-in user. | |
* | |
* @return | |
* An object representing the shortcut set that should be displayed to the | |
* current user. If the user does not have an explicit shortcut set defined, | |
* the default set is returned. | |
*/ | |
function shortcut_current_displayed_set($account = NULL) { | |
$shortcut_sets = &drupal_static(__FUNCTION__, []); | |
$user = \Drupal::currentUser(); | |
if (!isset($account)) { | |
$account = $user; | |
} | |
// Try to return a shortcut set from the static cache. | |
if (isset($shortcut_sets[$account->id()])) { | |
return $shortcut_sets[$account->id()]; | |
} | |
// If none was found, try to find a shortcut set that is explicitly assigned | |
// to this user. | |
$shortcut_set_name = \Drupal::entityTypeManager() | |
->getStorage('shortcut_set') | |
->getAssignedToUser($account); | |
if ($shortcut_set_name) { | |
$shortcut_set = ShortcutSet::load($shortcut_set_name); | |
} | |
// Otherwise, use the default set. | |
else { | |
$shortcut_set = shortcut_default_set($account); | |
} | |
$shortcut_sets[$account->id()] = $shortcut_set; | |
return $shortcut_set; | |
} | |
<snip> | |
/** | |
* Implements hook_toolbar(). | |
*/ | |
function shortcut_toolbar() { | |
$user = \Drupal::currentUser(); | |
$items = []; | |
$items['shortcuts'] = [ | |
'#cache' => [ | |
'contexts' => [ | |
'user.permissions', | |
], | |
], | |
]; | |
if ($user->hasPermission('access shortcuts')) { | |
$shortcut_set = shortcut_current_displayed_set(); | |
$items['shortcuts'] += [ | |
'#type' => 'toolbar_item', | |
'tab' => [ | |
'#type' => 'link', | |
'#title' => t('Shortcuts'), | |
'#url' => $shortcut_set->toUrl('collection'), // <<<--- line 401 | |
'#attributes' => [ | |
'title' => t('Shortcuts'), | |
'class' => ['toolbar-icon', 'toolbar-icon-shortcut'], | |
], | |
], | |
'tray' => [ | |
'#heading' => t('User-defined shortcuts'), | |
'children' => [ | |
'#lazy_builder' => ['shortcut.lazy_builders:lazyLinks', []], | |
'#create_placeholder' => TRUE, | |
'#cache' => [ | |
'keys' => ['shortcut_set_toolbar_links'], | |
'contexts' => ['user'], | |
], | |
], | |
], | |
'#weight' => -10, | |
'#attached' => [ | |
'library' => [ | |
'shortcut/drupal.shortcut', | |
], | |
], | |
]; | |
} | |
return $items; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment