不能使用 'Object 作为类名,因为它是保留的 Cake 2.2.x [英] Cannot use 'Object as class name as it is reserved Cake 2.2.x

查看:17
本文介绍了不能使用 'Object 作为类名,因为它是保留的 Cake 2.2.x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm having an issue trying to set up a testing copy of a site we have running, I have the files and applications installed under a Mint VM and when I point apache at the directory I get a 500 error and the following-

[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
Stack trace:
#0 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ExceptionRenderer.php(92): ExceptionRenderer->_getController(Object(InternalErrorException))
#1 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(126): ExceptionRenderer->__construct(Object(InternalErrorException))
#2 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(284): ErrorHandler::handleException(Object(InternalErrorException))
#3 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ErrorHandler.php(213): ErrorHandler::handleFatalError(64, 'Cannot use 'Obj...', '/home/jamesmcgr...', 30)
#4 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/App.php(933): ErrorHandler::handleError(64, 'Cannot use 'Obj...', '/home/jamesmcgr...', 30, Array)
#5 /home/jamesmcgrath/Documents/dashboard/lib/Cake/Core/App.php(906): App::_checkFatalError()
#6 [internal function]: App::shutdow in /home/jamesmcgrath/Documents/dashboard/lib/Cake/Error/ExceptionRenderer.php on line 174

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

The weird thing is we've ripped the files straight from the webserver, which is functioning correctly. The first error makes me believe that it's due to the php or apache versions being different based on what I've read elsewhere (the working webserver is 7.1.10 and the testing one is 7.2.10, I can't determine what version of apache the webserver is running).

我不确定这两个错误是否相关,我还在适应这种环境,所以在学习这些东西方面进展缓慢.

I'm not sure if the two errors are related, I'm still getting used to this environment so progress is slow picking up this stuff.

任何帮助都将不胜感激.

Any help at all would be greatly appreciated.

推荐答案

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

The latter error is caused by the problem that causes former error, and the former error should be rather self-explantory, the name Object is reserved and cannot be used as class name anymore.

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

Object has become a hard-reserved name in PHP 7.2, after being soft-reserved as of PHP 7.0. For proper PHP 7.2 compatibility, upgrade your CakePHP dependency to at least the latest 2.10.x release.

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

If you are using the built-in encryption, you'll also have to either switch to OpenSSL (see the Security.useOpenSsl configuration option), or if the encryption that your app is using isn't compatible, install Mcrypt via PECL, or use a polyfill like phpseclib/mcrypt_compat.

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

If you cannot upgrade CakePHP at this moment, then you'll have to downgrade your PHP installation to 7.1.x or earlier.

另见

这篇关于不能使用 'Object 作为类名,因为它是保留的 Cake 2.2.x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆