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

Ответить
Аватара пользователя
meu3
Сообщения: 455
Зарегистрирован: 28 сен 2018, 13:21
Имя: Юрий Трифонов
Откуда: Россия Севастополь
Организация: IDEA

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

Сообщение 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
Аватара пользователя
meu3
Сообщения: 455
Зарегистрирован: 28 сен 2018, 13:21
Имя: Юрий Трифонов
Откуда: Россия Севастополь
Организация: IDEA

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

Сообщение 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)
Аватара пользователя
support
Техническая поддержка
Сообщения: 9016
Зарегистрирован: 19 окт 2014, 18:22
Имя: Харчишин Сергей
Откуда: Крым, Евпатория

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

Сообщение support »

Поправил для версии 3.4.3
Ответить