LoginSignup
5
3

More than 5 years have passed since last update.

NetCommons3をPHP7.2以上の環境でインストールすると内部エラーになる

Posted at

2018/08/18現在配布中の NetCommons3.1.10 をPHP7.2環境のサーバにインストールしようとすると、管理者アカウントを入力して送信した時点で「内部エラー」になってインストールが先にすすみません。

原因は単純で、CakePHP2のMigrationsプラグインで、PHPの予約語であるobjectと同名のクラスを利用してるから。

app/tmp/logs/error.log みると下記の様なエラーが記録されてるはずです。

 Fatal Error (64): Cannot use 'object' as class name as it is reserved in [/home/xxxx/NetCommons3/vendors/cakephp/cakephp/lib/Cake/Core/Object.php, line 18]

Object から CakeObjectへ書き換える

問題のファイルは、 app/Plugin/Migrations/Lib/CakeMigration.php なのでこのファイルの1箇所を書き換えればインストールできるようになります。

17行目

class CakeMigration extends Object {

↑ を ↓ に変更。

class CakeMigration extends CakeObject {

Migrationsプラグインが対応してくれれば、一番いいんだけど https://github.com/CakeDC/migrations みてると更新とまってそうな気も…^^;

5
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3