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

Jam*_*ath 1 php cakephp cakephp-2.2 cakephp-2.x php-7.2

我在尝试设置我们正在运行的站点的测试副本时遇到问题,我在 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
Run Code Online (Sandbox Code Playgroud)

奇怪的是,我们直接从运行正常的网络服务器中提取了文件。第一个错误让我相信这是由于 php 或 apache 版本根据我在其他地方读到的内容不同(工作网络服务器是 7.1.10,测试服务器是 7.2.10,我无法确定是什么版本的apache 网络服务器正在运行)。

我不确定这两个错误是否相关,我仍然在适应这种环境,所以学习这些东西的进度很慢。

任何帮助都将不胜感激。

ndm*_*ndm 5

后一个错误是由导致前一个错误的问题引起的,前一个错误应该是不言自明的,名称Object是保留的,不能再用作类名。

Object在 PHP 中7.2被软保留后,已成为 PHP 中的硬保留名称7.0。为了获得适当的 PHP7.2兼容性,请将您的 CakePHP 依赖项升级到至少最新2.10.x版本。

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

如果此时您无法升级 CakePHP,则必须将 PHP 安装降级到7.1.x或更早。

也可以看看