Problem/Motivation
When displaying content with bLazy enabled, one gets warnings on PHP 8.1
Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\blazy\BlazyManagerBase->getIoSettings() (line 293 of modules/contrib/blazy/src/BlazyManagerBase.php).
Proposed resolution
Patch BlazyManagerBase::getIoSettings() by null-coalescing the trim() argument to an empty string:
$thold = trim($this->configLoad('io.threshold') ?? "");
Remaining tasks
Convert to patch or merge request.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
fgmComment #3
fgmComment #5
gausarts commentedI couldn't reproduce it, likely because I had saved Blazy UI form thus far, and the value was already a string :)
But it will surely spit the warning before anyone started to save the Blazy UI form, so thanks for the catch.
Committed. Thank you for contribution.
Comment #7
andyf commentedI believe this is the equivalent patch for 2.5 if you're still using that.
Thanks!
Comment #8
manikandank03 commentedPatch #7 works fine for the 2.5 version with PHP 8.1, thanks @Andyf