Игорь

Игорь

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

Ошибка 500 вместо 404

Добрый день.

В интернете по этой проблеме информации не нашел. Заранее спасибо всем за помощь.

При переходе по несуществующему url на сайте вместо 404 — Ошибка 500.

Для 404 страница создана, опубликована, в настройках modx установлен id этой страницы.

В логах
PHP Fatal error:  Call to a member function route() on null in /home/u172172/aprioris.ru/www/core/cache/includes/elements/modplugin/18.include.cache.php on line 31

Файл 18.include.cache.php в котором ошибка
<?php
/**
 * @package visioncart
 */

if ($modx->context->get('key') == 'mgr') {
	switch((string) $modx->event->name) {
		case 'OnBeforeCacheUpdate':
			$modx->cacheManager->refresh(array(
				'visioncart' => array(
					'.php'
				)
			));
			break;
	}
	return false;
}

switch((string) $modx->event->name) {
	case 'OnWebPageInit':
		$corePath = $modx->getOption('visioncart.core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH));
		$modx->addPackage('visioncart', $corePath.'components/visioncart/model/');
		$modx->visioncart = $modx->getService('visioncart', 'VisionCart', $corePath.'components/visioncart/model/visioncart/', array(
			'method' => (string) (isset($_REQUEST['method']) && $_REQUEST['method'] != '') ? strtolower($_REQUEST['method']) : 'resource',
			'initialize' => 'plugin',
			'context' => (string) $modx->context->get('key'),
			'event' => (string) $modx->event->name
		));
		break;
	case 'OnPageNotFound':
		$modx->visioncart->route(array(
			'method' => (string) (isset($_REQUEST['method']) && $_REQUEST['method'] != '') ? strtolower($_REQUEST['method']) : 'resource',
			'initialize' => 'plugin',
			'context' => (string) $modx->context->get('key'),
			'event' => (string) $modx->event->name
		));
		break;
	case 'OnLoadWebDocument':
		$modx->visioncart->assign(array(
			'method' => (string) (isset($_REQUEST['method']) && $_REQUEST['method'] != '') ? strtolower($_REQUEST['method']) : 'resource',
			'initialize' => 'plugin',
			'context' => (string) $modx->context->get('key'),
			'event' => (string) $modx->event->name
		));
		break;
	default:
		//exit($modx->event->name);
		break;
}
return;
Игорь
15 мая 2019, 14:17
modx.pro
477
0