modx3 и php8

Привет,
у меня следующая проблема

ERROR @ /core/components/pdotools/src/Fetch.php : 229) PHP warning: Array to string conversion
и
/core/src/Revolution/Processors/Workspace/Packages/GetList.php : 228) PHP warning: Trying to access array offset on value of type null
и
ERROR @ /core/src/Revolution/modTemplateVar.php : 331) PHP warning: Undefined array key "class_key"
и
/core/src/Revolution/modX.php : 2584) Could not prepare context: mgr
и
(ERROR @ /core/cache/includes/elements/modx/revolution/modplugin/1.include.cache.php : 38) PHP warning: Undefined array key "q"
и
ERROR @ /core/components/modxminify/model/modxminify/modxminify.class.php : 186) PHP warning: Undefined variable $skip
и
ERROR @ /connectors/lang.js.php : 64) PHP warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL
modx 3.0.3-pl
php 8.2.4
nginx

modplugin 1
<?php
if ($modx->context->get('key') !== 'mgr') {

    $contexts = array();

    $cacheKey = $modx->getOption('cache_context_map_key', $scriptProperties, 'context_map');
    $cacheOptions = array(
        xPDO::OPT_CACHE_HANDLER => $modx->getOption("cache_{$cacheKey}_handler", $scriptProperties, $modx->getOption(xPDO::OPT_CACHE_HANDLER)),
        xPDO::OPT_CACHE_EXPIRES => $modx->getOption("cache_{$cacheKey}_expires", $scriptProperties, $modx->getOption(xPDO::OPT_CACHE_EXPIRES)),
    );
    /** @var xPDOCache $contextCache */
    $contextCache = $modx->cacheManager->getCacheProvider($cacheKey, $cacheOptions);

    if ($contextCache) {
        $contexts = $contextCache->get('context_map');
    }

    if (empty($contexts)) {
        /** @var modContext $contextsGraph */
        $query = $modx->newQuery('modContext');
        $query->where(array('modContext.key:NOT IN' => array('web', 'mgr')));
        $query->sortby($modx->escape('modContext') . '.' . $modx->escape('key'), 'ASC');
        $contextsGraph = $modx->getCollectionGraph('modContext', '{"ContextSettings":{}}', $query);
        foreach ($contextsGraph as $context) {
            $contextSettings = array();
            foreach ($context->ContextSettings as $cSetting) {
                $contextSettings[$cSetting->get('key')] = $cSetting->get('value');
            }
            $contexts[$context->get('key')] = $contextSettings;
        }
        unset($contextsGraph);
        if ($contextCache) {
            $contextCache->set('context_map', $contexts);
        }
    }

    if (!empty($contexts)) {
        $pieces = explode('/', trim($_REQUEST[$modx->getOption('request_param_alias', null, 'q')], ' '), 2);
        if (count($pieces) > 0) {
            foreach($contexts as $cKey => $cSettings) {
                if ($pieces[0] == $cKey) {
                    if (isset($pieces[1])) {
                        $_REQUEST[$modx->getOption('request_param_alias', null, 'q')] = $pieces[1];
                    } else {
                        $modx->sendRedirect(MODX_SITE_URL . $pieces[0] . '/', array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
                    }
                    $modx->switchContext($cKey);
                    $modx->log(modX::LOG_LEVEL_INFO, "Switched to context {$cKey} from URI {$_REQUEST['q']}");
                    break;
                }
            }
        }
    }
}
Chavdarov
20 марта 2023, 12:36
modx.pro
843
0

Комментарии: 3

vectorserver
21 марта 2023, 08:10
+1
После <?php пропиши, error_reporting(0);, а по хорошему в php8 нужно указывать типизацию!

<?php
error_reporting(0);
if ($modx->context->get('key') !== 'mgr') {
///code
}
    Chavdarov
    21 марта 2023, 11:04
    0
    Я благодарю вас от всего сердца!
    эта ошибка прекратилась
    (ERROR @ /core/cache/includes/elements/modx/revolution/modplugin/1.include.cache.php : 38) PHP warning: Undefined array key "q"
    НО
    эта ошибка постоянно выскакивает
    ERROR @ /var/www/amtis/web/core/src/Revolution/modX.php : 2584) Could not prepare context: mgr
      Николай Савин
      21 марта 2023, 11:08
      0
      Первое Это не ошибка, а предупреждение. И оно не прекратилась — вы просто отключили уведомления.
    Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
    3