Chavdarov

Chavdarov

С нами с 21 июля 2019; Место в рейтинге пользователей: #2777

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
1 090
0