Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

php - Cannot use 'Object as class name as it is reserved Cake 2.2.x

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 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.

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.

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

See also


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...