Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When the parent implementation of \Drupal\Core\Template\Loader\ThemeRegistryLoader::getCacheKey()
is called it causes deprecations on PHP 8.1 because it passes NULL to strlen().
Steps to reproduce
See tests on #3220021: [meta] Ensure compatibility of Drupal 9 with PHP 8.1 (as it evolves)
Proposed resolution
Re implement getCacheKey to do less work.
Remaining tasks
User interface changes
N/a
API changes
N/a
Data model changes
N/a
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#5 | 2-5-interdiff.txt | 706 bytes | alexpott |
#5 | 3239859-5.patch | 643 bytes | alexpott |
#2 | 3239859-2.patch | 720 bytes | alexpott |
Comments
Comment #2
alexpottHere's the fix from the meta.
Comment #3
alexpottNote this does not need to be fixed upstream because we override
\Twig\Loader\FilesystemLoader::__construct()
with the result that\Twig\Loader\FilesystemLoader::$rootPath
is NULL.\Twig\Loader\FilesystemLoader::$rootPath
is a private so we can't set it to an empty string.Comment #4
longwaveI guess this is copied from upstream and fixed for our coding standards, but the rest of this class is all Drupal code - we don't use yoda conditions elsewhere, so should we refactor this to be more Drupally?
Comment #5
alexpottGood point. I think all of that can more elegantly be written like this...
Comment #6
longwaveMuch cleaner!
Comment #7
larowlanCommitted f8f2752 and pushed to 9.3.x. Thanks!