Fatal error: Cannot use 'Object' as class name as it is reserved
17,361
Solution 1
"Object" is one of the reserved keyword of PHP. You can not use it as class name. Change the class name to resolve the error.
Solution 2
Use Php 7.1 version. It will solve that issue
Related videos on Youtube
Author by
ZUHDI
Updated on May 25, 2022Comments
-
ZUHDI almost 2 years
Fatal error: Cannot use 'Object' as class name as it is reserved
I'm trying to bake my project but it shows this error. I'm using cakephp 2.5.4 and PHP 7.0.32
I tried to change the lib folder I used the lib folder for 2.8.0 and I tried to change PHP version to 5.6.38 but nothing worked. :(
-
MD. Jubair Mizan over 5 yearsPlease add your code that will be easy for understand what actually problem you happend
-
ArtisticPhoenix over 5 yearsThat is true
Class Object
orClass true
or any of the other "reserved" words don't work as class name. It's just part of the "deal" -
ndm over 5 yearsNote that you aren't actually using PHP 7.0.32 or 5.6.38, but PHP 7.2+, as
Object
is only a reservered name as of PHP 7.2. You're probably looking in the wrong place, hence whatever you're changing with regards to the PHP version has no effect. For CakePHP 2.x you need to use the latest 2.10 version for proper PHP 7.2 compatibility. stackoverflow.com/questions/52981403/… -
Budi Mulyo almost 5 yearsalmost same question, in different framework.. stackoverflow.com/questions/50269306/…
-
-
Halnex about 3 years7.1 didn't work for me but 5.6 did! Thanks!