Тестирование cron скрипта Битрикс
Пытаюсь протестить cron-скрипт.
php -f local/cron/notify_statistic_product.php
В результате в консоле вижу ошибку
syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/u1304156/data/www/domain.ru/bitrix/modules/main/include/autoload.php on line 24
Иду в bitrix/modules/main/include/autoload.php. Вижу там:
use Bitrix\Main\Loader;
//main is usually included directly
$documentRoot = Loader::getDocumentRoot();
foreach(
[
'Bitrix\\Main' => '/bitrix/modules/main/lib',
'Bitrix\\UI' => '/bitrix/modules/ui/lib',
'Psr\\Container' => '/bitrix/modules/main/vendor/psr/container/src',
'Psr\\Log' => '/bitrix/modules/main/vendor/psr/log/Psr/Log',
'PHPMailer\\PHPMailer' => '/bitrix/modules/main/vendor/phpmailer/phpmailer/src',
'GeoIp2' => '/bitrix/modules/main/vendor/geoip2/geoip2/src',
'MaxMind\\Db' => '/bitrix/modules/main/vendor/maxmind-db/reader/src/MaxMind/Db',
]
as $namespace => $namespacePath
)
{
Loader::registerNamespace($namespace, $documentRoot.$namespacePath);
}
unset($namespace, $namespacePath);
spl_autoload_register([Loader::class, 'autoLoad']);
Loader::registerAutoLoadClasses(
'main',
[
'bitrix\\main\\application' => 'lib/application.php',
...
По сути ругается на строку
spl_autoload_register([Loader::class, 'autoLoad']);
Версия PHP 8.1. Версия Битрикс 22.600. Если кто сталкивался или знаетк как поправить, поделитесь плиз.
Источник: Stack Overflow на русском