lukasleitsch / kirby-blade

Enable Laravel Blade Template Engine for Kirby 4
MIT License
17 stars 4 forks source link

PHP 8.1 str_ends_with(): Passing null to parameter #1 ($haystack) of type string is deprecated #21

Closed wdebusschere closed 2 years ago

wdebusschere commented 2 years ago

In PHP 8.1 when null is passed to build in function, it is no longer silently converted to empty string. null migration deprecated php-8.1

See: https://github.com/lukasleitsch/kirby-blade/blob/4db7494ffd63ebcfaa34f6c3713db1a444a162b1/src/Snippet.php#L29 if (str_ends_with($file, Template::EXTENSION_BLADE)) {

Solution if (str_ends_with($file ?? '', Template::EXTENSION_BLADE)) {

iskrisis commented 2 years ago

I think this is a good solution. Many people depend on null snippets.

lukasleitsch commented 2 years ago

Thanks. Fixed.