kamilwylegala / cakephp2-php8

CakePHP 2 fork that supports PHP 8
116 stars 51 forks source link

cake i18n extract fails on PHP 8.1 #28

Closed colddiver closed 1 year ago

colddiver commented 1 year ago

Hello,

Many thanks for your port of cakephp2 to php8. It has given me a few extra years to complete the migration of my site to the latest Cake.

When running: $ ./Console/cake i18n extract

... I end up with a fatal error: PHP Fatal error: Cannot use 'object' as class name as it is reserved in C:\xampp\htdocs\cakephp2-php8\lib\Cake\Core\Object.php on line 18

Attempting to use an old PHP does to bypass this issue does not work and fails with the following: Fatal error: Declaration of CakeRequest::offsetExists(mixed $name): bool must be compatible with ArrayAccess::offsetExists($offset) in C:\xampp\htdocs\cakephp2-php8\lib\Cake\Network\CakeRequest.php on line 35

kamilwylegala commented 1 year ago

Hey @colddiver Thanks for reporting this.

Currently in my project I don't use cake console features.

Could you check if removing lines from files below helps:

Object.php

<?php
App::uses('CakeObject', 'Core');
-class_alias('CakeObject', 'Object');

And in Cake/bootstrap.php:

App::uses('CakeObject', 'Core');
-App::uses('Object', 'Core');
App::uses('Multibyte', 'I18n');

And also in CakeObjectTest.php.

kamilwylegala commented 1 year ago

Closing due to inactivity. Feel free to reopen if needed.