Problem/Motivation
template_preprocess_image_formatter() could use mb_strlen() on NULL title
Steps to reproduce
Run core/modules/image/tests/src/Kernel/ImageFormatterTest.php on PHP 8.1
2x: mb_strlen(): Passing null to parameter #1 ($string) of type string is deprecated
2x in ImageFormatterTest::testImageFormatterSvg from Drupal\Tests\image\KernelProposed resolution
Check if NULL passed
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3240906-2.patch | 584 bytes | andypost |
Comments
Comment #2
andypostPatch from https://git.drupalcode.org/project/drupal/-/commit/2efec5942bd7f5a885234...
Comment #3
alexpottI think this could be better written as:
if (!empty(item->title)) {Should have the same effect as far as I can see.
Comment #4
andypostmakes sense
Comment #5
mondrakebut a title could be legitimately “0”, and that would be considered empty and therefore skipped, no?
Comment #6
andypost@mondrake thank you! it's valid reason - re-upload patch #2
Comment #7
andypostotoh it means we have no test coverage for "0" in titles
Comment #8
alexpott@mondrake++
Comment #9
daffie commentedLooks good to me.
Comment #11
larowlanCommitted 15e1c65 and pushed to 9.3.x. Thanks!