不能使用'Object作为类名,因为已保留Cake 2.2.x

时间:2018-10-25 04:30:46

标签: php cakephp php-7.2 cakephp-2.2 cakephp-2.x

我在尝试设置我们正在运行的网站的测试副本时遇到问题,我在Mint VM下安装了文件和应用程序,当我将apache指向目录时,出现500错误和以下错误-

[Thu Oct 25 15:09:39.714201 2018] [php7:error] [pid 8945] [client 192.168.0.14:52237] PHP Fatal error:  Cannot use 'Object' as class name as it is reserved in /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/Object.php on line 30
[Thu Oct 25 15:09:39.714547 2018] [php7:error] [pid 8945] [client 192.168.0.14:52237] PHP Fatal error:  Uncaught Error: Class 'Controller' not found in /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ExceptionRenderer.php:174\nStack trace:\n#0 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ExceptionRenderer.php(92): ExceptionRenderer->_getController(Object(InternalErrorException))\n#1 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(126): ExceptionRenderer->__construct(Object(InternalErrorException))\n#2 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(284): ErrorHandler::handleException(Object(InternalErrorException))\n#3 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(213): ErrorHandler::handleFatalError(64, 'Cannot use 'Obj...', '/home/jamesmcgr...', 30)\n#4 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/App.php(933): ErrorHandler::handleError(64, 'Cannot use 'Obj...', '/home/jamesmcgr...', 30, Array)\n#5 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/App.php(906): App::_checkFatalError()\n#6 [internal function]: App::shutdow in /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ExceptionRenderer.php on line 174

奇怪的是,我们直接从网络服务器上删除了文件,该服务器运行正常。第一个错误使我相信这是由于php或apache版本因我在其他地方所读的内容而异(工作的Web服务器是7.1.10,测试的是7.2.10,我无法确定该版本是什么) apache服务器正在运行)。

我不确定这两个错误是否相关,我仍然习惯于这种环境,因此进展缓慢。

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

后一个错误是由导致前一个错误的问题引起的,并且前一个错误应该是自欺欺人的,名称Object是保留的,不能再用作类名。为了获得适当的PHP 7.2兼容性,请将CakePHP依赖项升级到最新的2.10.x版本。

如果您使用内置加密,则还必须切换到OpenSSL(请参阅Security.useOpenSsl配置选项),或者如果您的应用程序使用的加密不兼容,请安装通过PECL加密,或使用phpseclib/mcrypt_compat之类的polyfill。

如果此时不能升级CakePHP,则必须降级PHP安装。

另请参见