Problem/Motivation
Trying to get a grip on what's wrong here - thought I'd report it even in an incomplete state.
Upgraded my site to Bootstrap Barrio 5.5.21, and then get an white screen unexpected error when viewing my homepage:
Errors in the logs are of the form:
Message Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\Core\Url::fromUri() (line 281 of /app/web/core/lib/Drupal/Core/Url.php)
Message Deprecated function: str_starts_with(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\Core\Url::fromUri() (line 289 of /app/web/core/lib/Drupal/Core/Url.php)
InvalidArgumentException: The URI '' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 293 of /app/web/core/lib/Drupal/Core/Url.php).
Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\Core\Url::fromUri() (line 281 of /app/web/core/lib/Drupal/Core/Url.php)
If I downgrade back to version 5.5.20, the error goes away and my site homepage loads.
It does not seem to be related to the recent core update.
Steps to reproduce
Unknown at the moment, just want to document what the heck is happening to try to add more info.
Based on the code, it looks like it has something to do with the construction of the Main Navigation in Twig. The array of Drupal\Core\Url objects have a uri of null.
I don't think it has to do with the recent core update.
Sorry folks - still recovering from my flu shot and my brain is shot - will try to report more on this tomorrow.
If you're having some weird bootstrap barrio issue after the recent update, try rolling back to 5.5.20.
Comments
Comment #2
trevorbradley commentedOnly happens on the anonymous homepage, not when I'm logged in (though the main navigation is still missing links when I'm logged in)
Comment #3
trevorbradley commentedOK, trying to tackle this again. It's failing somewhere in the rendering of menu_main.twig.
It seems to be choking on the rendering of
{{ link(item.title, item.url, {'class': link_classes}) }}
If I replace this with
{{ dump(item.url) }}
I definitely get a Drupal\Core\Url. item.title is also not null.
But when TwigExtension->getLink is called, the first ($text) and second ($url) parameter are both showing up as null.
I managed to get into the cached files, and it's failing on
yield (string) $this->extensions['Drupal\Core\Template\TwigExtension']->escapeFilter($this->env, $this->extensions['Drupal\Core\Template\TwigExtension']->getLink(CoreExtension::getAttribute($this->env, $this->source, $context["item"], "title", [], "any", false, false, true, 41), CoreExtension::getAttribute($this->env, $this->source, $context["item"], "url", [], "any", false, false, true, 41), ["class" => ($context["link_classes"] ?? null)]), "html", null, true);
Not sure why this is failing when 5.5.20 is working fine. Presumably $this->source is different for 5.5.20 vs 5.5.21, but I don't think it's just a matter of replacing the components directory.
I'm out of time, will attempt to tackle more later.