@SE_Plus

Перешёл на PHP8.2 с PHP7.4 как обойти ошибку [TypeError] Cannot access offset of type string on string (0)?

В модулях на главной странице начали вылазить ошибки((

[TypeError] 
Cannot access offset of type string on string (0)
/home/t/tursp/tur-sp.ru/public_html/bitrix/templates/sp/components/bitrix/news/tours/bitrix/news.detail/.default/template.php:16
#0: include
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component_template.php:790
#1: CBitrixComponentTemplate->__IncludePHPTemplate(array, array, string)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component_template.php:885
#2: CBitrixComponentTemplate->IncludeTemplate(array)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component.php:776
#3: CBitrixComponent->showComponentTemplate()
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component.php:716
#4: CBitrixComponent->includeComponentTemplate()
	/home/t/tursp/tur-sp.ru/public_html/bitrix/components/bitrix/news.detail/component.php:515
#5: include(string)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component.php:607
#6: CBitrixComponent->__includeComponent()
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component.php:684
#7: CBitrixComponent->includeComponent(string, array, object, boolean)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/main.php:1072
#8: CAllMain->IncludeComponent(string, string, array, object)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/templates/sp/components/bitrix/news/tours/detail.php:15
#9: include(string)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component_template.php:790
#10: CBitrixComponentTemplate->__IncludePHPTemplate(array, array, string)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component_template.php:885
#11: CBitrixComponentTemplate->IncludeTemplate(array)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component.php:776
#12: CBitrixComponent->showComponentTemplate()
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component.php:716
#13: CBitrixComponent->includeComponentTemplate(string)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/components/bitrix/news/component.php:336
#14: include(string)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component.php:607
#15: CBitrixComponent->__includeComponent()
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/component.php:684
#16: CBitrixComponent->includeComponent(string, array, boolean, boolean)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/classes/general/main.php:1072
#17: CAllMain->IncludeComponent(string, string, array, boolean)
	/home/t/tursp/tur-sp.ru/public_html/tours/index.php:4
#18: include_once(string)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/modules/main/include/urlrewrite.php:184
#19: include_once(string)
	/home/t/tursp/tur-sp.ru/public_html/bitrix/urlrewrite.php:2
----------
  • Вопрос задан
  • 1457 просмотров
Пригласить эксперта
Ответы на вопрос 1
Adamos
@Adamos
Судя по пути, вы прописывали свой кастомный шаблон одному из компонентов.
Ошибка тычет вас носом в ту строчку, куда приходят данные не в том виде, как вы ожидали (судя по тому, что проблема только в новых версиях - немного не в том, раньше оно просто преобразовывалось и все работало).
Отлаживайте, что именно там в данных (поставьте перед этой строчкой запись в файл, как самое простое) или уберите свой кастомный шаблон, вернув тот, который идет из коробки (скорее всего, страшненький и поперек дизайна - но без подобных ошибок).
А можно попробовать сравнить шаблон из коробки с вашим, чтобы понять, как нужно обращаться к данным.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы