Description
I updated CakePHP to 5.4.0.
The Migrations plugin is the latest version.
Now, using BakeMigrationDiffCommand I get this:
$ bin/cake bake migration_diff --generate-only -v SimpleTest
2026-07-21 21:04:02 error: [Error] Typed property Cake\Database\Schema\Index::$accessMethod must not be accessed before initialization in /home/mirko/PhpstormProjects/climat/vendor/cakephp/cakephp/src/Database/Schema/Index.php on line 312
Stack Trace:
- CORE/src/Database/Schema/TableSchema.php:638
- ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php:470
- ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php:223
- ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php:205
- ROOT/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php:185
- ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php:143
- ROOT/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php:143
- CORE/src/Console/BaseCommand.php:261
- CORE/src/Console/CommandRunner.php:451
- CORE/src/Console/CommandRunner.php:205
- ROOT/bin/cake.php:12
- [main]:
[Error] Typed property Cake\Database\Schema\Index::$accessMethod must not be accessed before initialization in /home/mirko/PhpstormProjects/climat/vendor/cakephp/cakephp/src/Database/Schema/Index.php on line 312
Stack Trace:
Cake\Database\Schema\Index->toArray() - CORE/src/Database/Schema/TableSchema.php, line 638
Cake\Database\Schema\TableSchema->getIndex() - ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php, line 470
Migrations\Command\BakeMigrationDiffCommand->getIndexes() - ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php, line 223
Migrations\Command\BakeMigrationDiffCommand->calculateDiff() - ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php, line 205
Migrations\Command\BakeMigrationDiffCommand->templateData() - ROOT/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php, line 185
Migrations\Command\BakeSimpleMigrationCommand->bake() - ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php, line 143
Migrations\Command\BakeMigrationDiffCommand->bake() - ROOT/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php, line 143
Migrations\Command\BakeSimpleMigrationCommand->execute() - CORE/src/Console/BaseCommand.php, line 261
Cake\Console\BaseCommand->run() - CORE/src/Console/CommandRunner.php, line 451
Cake\Console\CommandRunner->runCommand() - CORE/src/Console/CommandRunner.php, line 205
Cake\Console\CommandRunner->run() - ROOT/bin/cake.php, line 12
[main] - [main], line 0
It seems to me that the problem is here:
https://github.com/cakephp/migrations/blob/5.x/src/Command/BakeMigrationDiffCommand.php#L470
$index !== $this->dumpSchema[$table]->getIndex($indexName)
Index is retrieved and, doing an array comparison, its toArray() method is called.
https://github.com/cakephp/cakephp/compare/5.3.7...5.4.0?diff=unified&w#diff-7168039bb639937121b38cff5babc9801bd771c697b0dda0bbb0f8dfe88c91a2R300
I'll point out that I'm on MariaDB, just in case. I think the problem is with Cake and not Migrations, but I could be wrong.
CakePHP Version
5.4
PHP Version
No response
Description
I updated CakePHP to 5.4.0.
The Migrations plugin is the latest version.
Now, using
BakeMigrationDiffCommandI get this:It seems to me that the problem is here:
https://github.com/cakephp/migrations/blob/5.x/src/Command/BakeMigrationDiffCommand.php#L470
Indexis retrieved and, doing an array comparison, itstoArray()method is called.https://github.com/cakephp/cakephp/compare/5.3.7...5.4.0?diff=unified&w#diff-7168039bb639937121b38cff5babc9801bd771c697b0dda0bbb0f8dfe88c91a2R300
I'll point out that I'm on MariaDB, just in case. I think the problem is with Cake and not Migrations, but I could be wrong.
CakePHP Version
5.4
PHP Version
No response