Страница 1 из 1

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated

Добавлено: 23 июл 2023, 20:49
meu3
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/uxxxx/data/www/xxxxx.ru/includes/classes/fieldstypes/fieldtype_text_pattern.php on line 142

Re: Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated

Добавлено: 23 июл 2023, 20:54
meu3
Migration to PHP 8.1 - how to fix Deprecated Passing null to parameter error - rename build in functions

PHP 8.1 has deprecated passing null as parameters to a lot of core functions.
Depending how many cases you have, you may be able to just fix them manually a few at a time, either adding ?? '' or fixing a logic bug where you weren't expecting a null anyway.

Нужно в 142 строке добавить ->
должно получится так:

Код: Выделить всё

if(strlen($item['field_' . $field['id']] ?? '') == 0)

Re: Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated

Добавлено: 25 июл 2023, 09:22
support
Поправил для версии 3.4.3