SOLVED – MODx Evolution. Zapewnienie wspracia dla PHP 5.6 [UPDATE]
Starsze wersje tego systemu CMS nie wspierają PHP 5.6 a dokładniej dla wykluczonych funkcji związanych regex i obsługą mysql:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /public_html/manager/includes/protect.inc.php on line 34 Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /public_html/manager/includes/extenders/dbapi.mysql.class.inc.php on line 89 Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /public_html/manager/includes/extenders/dbapi.mysql.class.inc.php on line 89
na szczęście można jeszcze przywrócić ten CMS do życia po paru modyfikacjach kodu.
W pliku:
index.php
usuń wpis:
error_reporting(E_ALL & ~E_NOTICE);
W pliku:
manager/index.php
usuń wpis:
error_reporting(E_ALL & ~E_NOTICE);
W pliku:
manager/includes/config.inc.php
Usuń wpis:
error_reporting(E_ALL & ~E_NOTICE);
W pliku:
manager/includes/document.parser.class.inc.php
Znajdź funkcję:
executeParser()
I zamień kod:
//error_reporting(0);
if (version_compare(phpversion(), "5.0.0", ">="))
set_error_handler(array (
& $this,
"phpError"
), E_ALL);
else
set_error_handler(array (
& $this,
"phpError"
));
$this->db->connect();
// get the settings
if (empty ($this->config)) {
$this->getSettings();
}
Na:
//error_reporting(0);
set_error_handler(array (
& $this,
"phpError"
), E_ALL);
$this->db->connect();
// get the settings
if (empty ($this->config)) {
$this->getSettings();
}
W tym samym pliku zamień kod:
function phpError($nr, $text, $file, $line) {
if (error_reporting() == 0 || $nr == 0 || ($nr == 8 && $this->stopOnNotice == false)) {
return true;
}
if (is_readable($file)) {
$source= file($file);
$source= htmlspecialchars($source[$line -1]);
} else {
$source= "";
} //Error $nr in $file at $line: $source
$this->messageQuit("PHP Parse Error", '', true, $nr, $file, $source, $text, $line);
}
na:
function phpError($nr, $text, $file, $line) {
if (error_reporting() == 0 || $nr == 0) {
return true;
}
if($this->stopOnNotice == false)
{
switch($nr)
{
case E_NOTICE:
if($this->error_reporting <= 2) return true;
break;
case E_STRICT:
case E_DEPRECATED:
if($this->error_reporting <= 1) return true;
break;
default:
if($this->error_reporting === 0) return true;
}
}
if (is_readable($file)) {
$source= file($file);
$source= htmlspecialchars($source[$line -1]);
} else {
$source= "";
} //Error $nr in $file at $line: $source
$this->messageQuit("PHP Parse Error", '', true, $nr, $file, $source, $text, $line);
}
W pliku:
manager/media/browser/mcpuk/connectors/php/connector.php
usuń kod:
error_reporting(E_ALL);
W pliku:
manager/includes/protect.inc.php
Na początku dodaj kod:
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
Dodatkowo jeśli posiadasz dodatkowe moduły usuń z nich wystąpienie:
error_reporting(E_ALL ^ E_NOTICE);
MOże sie ono znaleźć w plikach:
assets/modules/easynewsletter/backend.php assets/modules/easynewsletter/core.php

