You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encountering a type error when running a bake migration_diff. Hopefully this isn't user error. Additional versions that may be useful:
cakephp/bake: 3.1.1
robmorgan/phinx: 0.16.6
cakephp/migrations: 4.2.0 (i upgraded this all the way to 4.5 and the problem persisted).
Further, I also ran composer update -W and the problem persisted.
Steps to reproduce:
Run bin/cake bake migration_diff UserRateLimit with the following MySQL schema:
CREATETABLE `user_rate_limits` (
`id`intNOT NULL AUTO_INCREMENT,
`user_id`varchar(32) DEFAULT NULL,
`ip_address`varchar(64) NOT NULL,
`limit_type` enum('per_day','per_minute','auth') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Expected
Migration class to be created
Actual Result:
Sorry for this horrendous stacktrace:
2025-01-10 22:06:58 warning: Undefined array key "precision"
Trace:
Migrations\View\Helper\MigrationHelper->getColumnOption() /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php, line 1871
Twig\Extension\CoreExtension::getAttribute() /srv/app/vendor/twig/twig/src/Environment.php(407) : eval()'d code, line 166
__TwigTemplate_4c6b09aa2ff857341f1f31f07630396a->doDisplay() /srv/app/vendor/twig/twig/src/Template.php, line 387
Twig\Template->yield() /srv/app/vendor/twig/twig/src/Template.php, line 343
Twig\Template->display() /srv/app/vendor/twig/twig/src/Template.php, line 358
Twig\Template->render() /srv/app/vendor/twig/twig/src/TemplateWrapper.php, line 51
Twig\TemplateWrapper->render() /srv/app/vendor/cakephp/twig-view/src/View/TwigView.php, line 299
Cake\TwigView\View\TwigView->_evaluate() /srv/app/vendor/cakephp/cakephp/src/View/View.php, line 1145
Cake\View\View->_render() /srv/app/vendor/cakephp/bake/src/View/BakeView.php, line 91
Bake\View\BakeView->render() /srv/app/vendor/cakephp/bake/src/Utility/TemplateRenderer.php, line 101
Bake\Utility\TemplateRenderer->generate() /srv/app/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php, line 129
Migrations\Command\BakeSimpleMigrationCommand->bake() /srv/app/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php, line 139
Migrations\Command\BakeMigrationDiffCommand->bake() /srv/app/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php, line 92
Migrations\Command\BakeSimpleMigrationCommand->execute() /srv/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php, line 192
Cake\Console\BaseCommand->run() /srv/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 327
Cake\Console\CommandRunner->runCommand() /srv/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 168
Cake\Console\CommandRunner->run() /srv/app/bin/cake.php, line 12
[main]
warning: 2 :: Undefined array key "precision" on line 415 of /srv/app/vendor/cakephp/migrations/src/View/Helper/MigrationHelper.php
Stack Trace:
Migrations\View\Helper\MigrationHelper->getColumnOption() /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php, line 1871
Twig\Extension\CoreExtension::getAttribute() /srv/app/vendor/twig/twig/src/Environment.php(407) : eval()'d code, line 166
__TwigTemplate_4c6b09aa2ff857341f1f31f07630396a->doDisplay() /srv/app/vendor/twig/twig/src/Template.php, line 387
Twig\Template->yield() /srv/app/vendor/twig/twig/src/Template.php, line 343
Twig\Template->display() /srv/app/vendor/twig/twig/src/Template.php, line 358
Twig\Template->render() /srv/app/vendor/twig/twig/src/TemplateWrapper.php, line 51
Twig\TemplateWrapper->render() /srv/app/vendor/cakephp/twig-view/src/View/TwigView.php, line 299
Cake\TwigView\View\TwigView->_evaluate() /srv/app/vendor/cakephp/cakephp/src/View/View.php, line 1145
Cake\View\View->_render() /srv/app/vendor/cakephp/bake/src/View/BakeView.php, line 91
Bake\View\BakeView->render() /srv/app/vendor/cakephp/bake/src/Utility/TemplateRenderer.php, line 101
Bake\Utility\TemplateRenderer->generate() /srv/app/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php, line 129
Migrations\Command\BakeSimpleMigrationCommand->bake() /srv/app/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php, line 139
Migrations\Command\BakeMigrationDiffCommand->bake() /srv/app/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php, line 92
Migrations\Command\BakeSimpleMigrationCommand->execute() /srv/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php, line 192
Cake\Console\BaseCommand->run() /srv/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 327
Cake\Console\CommandRunner->runCommand() /srv/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 168
Cake\Console\CommandRunner->run() /srv/app/bin/cake.php, line 12
[main]
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 172.17.0.1:9003 (fallback through xdebug.client_host/xdebug.client_port).
2025-01-10 22:06:58 error: [Twig\Error\RuntimeError] An exception has been thrown during the rendering of a template ("Migrations\View\Helper\MigrationHelper::formatConstraintAction(): Argument cakephp/cakephp#1 ($constraint) must be of type string, null given, called in /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php on line 1871"). in /srv/app/vendor/cakephp/migrations/templates/bake/element/add-foreign-keys.twig on line 30
Stack Trace:
- /srv/app/vendor/twig/twig/src/Template.php:343
- /srv/app/vendor/twig/twig/src/Template.php:358
- /srv/app/vendor/twig/twig/src/TemplateWrapper.php:51
- /srv/app/vendor/cakephp/twig-view/src/View/TwigView.php:299
- /srv/app/vendor/cakephp/cakephp/src/View/View.php:1145
- /srv/app/vendor/cakephp/cakephp/src/View/View.php:1689
- /srv/app/vendor/cakephp/cakephp/src/View/View.php:676
- /srv/app/vendor/cakephp/migrations/src/View/Helper/MigrationHelper.php:651
- /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php:1871
- /srv/app/vendor/twig/twig/src/Environment.php(407) : eval()'d code:240
- /srv/app/vendor/twig/twig/src/Template.php:387
- /srv/app/vendor/twig/twig/src/Template.php:343
- /srv/app/vendor/twig/twig/src/Template.php:358
- /srv/app/vendor/twig/twig/src/TemplateWrapper.php:51
- /srv/app/vendor/cakephp/twig-view/src/View/TwigView.php:299
- /srv/app/vendor/cakephp/cakephp/src/View/View.php:1145
- /srv/app/vendor/cakephp/bake/src/View/BakeView.php:91
- /srv/app/vendor/cakephp/bake/src/Utility/TemplateRenderer.php:101
- /srv/app/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php:129
- /srv/app/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php:139
- /srv/app/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php:92
- /srv/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php:192
- /srv/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php:327
- /srv/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php:168
- /srv/app/bin/cake.php:12
- [main]:
Caused by: [TypeError] Migrations\View\Helper\MigrationHelper::formatConstraintAction(): Argument cakephp/cakephp#1 ($constraint) must be of type string, null given, called in /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php on line 1871 in /srv/app/vendor/cakephp/migrations/src/View/Helper/MigrationHelper.php on line 261
Stack Trace:
- /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php:1871
- /srv/app/vendor/twig/twig/src/Environment.php(407) : eval()'d code:109
- /srv/app/vendor/twig/twig/src/Template.php:387
- /srv/app/vendor/twig/twig/src/Template.php:343
- /srv/app/vendor/twig/twig/src/Template.php:358
- /srv/app/vendor/twig/twig/src/TemplateWrapper.php:51
- /srv/app/vendor/cakephp/twig-view/src/View/TwigView.php:299
- /srv/app/vendor/cakephp/cakephp/src/View/View.php:1145
- /srv/app/vendor/cakephp/cakephp/src/View/View.php:1689
- /srv/app/vendor/cakephp/cakephp/src/View/View.php:676
- /srv/app/vendor/cakephp/migrations/src/View/Helper/MigrationHelper.php:651
- /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php:1871
- /srv/app/vendor/twig/twig/src/Environment.php(407) : eval()'d code:240
- /srv/app/vendor/twig/twig/src/Template.php:387
- /srv/app/vendor/twig/twig/src/Template.php:343
- /srv/app/vendor/twig/twig/src/Template.php:358
- /srv/app/vendor/twig/twig/src/TemplateWrapper.php:51
- /srv/app/vendor/cakephp/twig-view/src/View/TwigView.php:299
- /srv/app/vendor/cakephp/cakephp/src/View/View.php:1145
- /srv/app/vendor/cakephp/bake/src/View/BakeView.php:91
- /srv/app/vendor/cakephp/bake/src/Utility/TemplateRenderer.php:101
- /srv/app/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php:129
- /srv/app/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php:139
- /srv/app/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php:92
- /srv/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php:192
- /srv/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php:327
- /srv/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php:168
- /srv/app/bin/cake.php:12
- [main]:
[Twig\Error\RuntimeError] An exception has been thrown during the rendering of a template ("Migrations\View\Helper\MigrationHelper::formatConstraintAction(): Argument cakephp/cakephp#1 ($constraint) must be of type string, null given, called in /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php on line 1871"). in /srv/app/vendor/cakephp/migrations/templates/bake/element/add-foreign-keys.twig on line 30
Stack Trace:
Twig\Template->yield() - ROOT/vendor/twig/twig/src/Template.php, line 343
Twig\Template->display() - ROOT/vendor/twig/twig/src/Template.php, line 358
Twig\Template->render() - ROOT/vendor/twig/twig/src/TemplateWrapper.php, line 51
Twig\TemplateWrapper->render() - ROOT/vendor/cakephp/twig-view/src/View/TwigView.php, line 299
Cake\TwigView\View\TwigView->_evaluate() - CORE/src/View/View.php, line 1145
Cake\View\View->_render() - CORE/src/View/View.php, line 1689
Cake\View\View->_renderElement() - CORE/src/View/View.php, line 676
Cake\View\View->element() - ROOT/vendor/cakephp/migrations/src/View/Helper/MigrationHelper.php, line 651
Migrations\View\Helper\MigrationHelper->element() - ROOT/vendor/twig/twig/src/Extension/CoreExtension.php, line 1871
Twig\Extension\CoreExtension::getAttribute() - ROOT/vendor/twig/twig/src/Environment.php(407) : eval()'d code, line 240
__TwigTemplate_4c6b09aa2ff857341f1f31f07630396a->doDisplay() - ROOT/vendor/twig/twig/src/Template.php, line 387
Twig\Template->yield() - ROOT/vendor/twig/twig/src/Template.php, line 343
Twig\Template->display() - ROOT/vendor/twig/twig/src/Template.php, line 358
Twig\Template->render() - ROOT/vendor/twig/twig/src/TemplateWrapper.php, line 51
Twig\TemplateWrapper->render() - ROOT/vendor/cakephp/twig-view/src/View/TwigView.php, line 299
Cake\TwigView\View\TwigView->_evaluate() - CORE/src/View/View.php, line 1145
Cake\View\View->_render() - ROOT/vendor/cakephp/bake/src/View/BakeView.php, line 91
Bake\View\BakeView->render() - ROOT/vendor/cakephp/bake/src/Utility/TemplateRenderer.php, line 101
Bake\Utility\TemplateRenderer->generate() - ROOT/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php, line 129
Migrations\Command\BakeSimpleMigrationCommand->bake() - ROOT/vendor/cakephp/migrations/src/Command/BakeMigrationDiffCommand.php, line 139
Migrations\Command\BakeMigrationDiffCommand->bake() - ROOT/vendor/cakephp/migrations/src/Command/BakeSimpleMigrationCommand.php, line 92
Migrations\Command\BakeSimpleMigrationCommand->execute() - CORE/src/Console/BaseCommand.php, line 192
Cake\Console\BaseCommand->run() - CORE/src/Console/CommandRunner.php, line 327
Cake\Console\CommandRunner->runCommand() - CORE/src/Console/CommandRunner.php, line 168
Cake\Console\CommandRunner->run() - ROOT/bin/cake.php, line 12
[main] - [main], line 0
Caused by [TypeError] Migrations\View\Helper\MigrationHelper::formatConstraintAction(): Argument cakephp/cakephp#1 ($constraint) must be of type string, null given, called in /srv/app/vendor/twig/twig/src/Extension/CoreExtension.php on line 1871 in /srv/app/vendor/cakephp/migrations/src/View/Helper/MigrationHelper.php on line 261
Stack Trace:
Migrations\View\Helper\MigrationHelper->formatConstraintAction() - ROOT/vendor/twig/twig/src/Extension/CoreExtension.php, line 1871
Twig\Extension\CoreExtension::getAttribute() - ROOT/vendor/twig/twig/src/Environment.php(407) : eval()'d code, line 109
__TwigTemplate_f249712c7740946c2b82eb62f96cd5d5->doDisplay() - ROOT/vendor/twig/twig/src/Template.php, line 387
[main] - [main], line 0
CakePHP Version
5.0.11
PHP Version
8.3
The text was updated successfully, but these errors were encountered:
cnizzardini
changed the title
Encountering a type error when running a bake migration_diff
Encountering a TypeError exception when running a bake migration_diff
Jan 11, 2025
I've tried to add this scenario as a test, hopefully the issue can reproduce in CI. I wasn't able to reproduce your issue when running this test locally.
Description
Encountering a type error when running a bake migration_diff. Hopefully this isn't user error. Additional versions that may be useful:
Further, I also ran
composer update -W
and the problem persisted.Steps to reproduce:
Run
bin/cake bake migration_diff UserRateLimit
with the following MySQL schema:Expected
Migration class to be created
Actual Result:
Sorry for this horrendous stacktrace:
CakePHP Version
5.0.11
PHP Version
8.3
The text was updated successfully, but these errors were encountered: