Skip to content

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Jan 20, 2026

Summary

This backports several important bug fixes from recent 5.x PRs (#1001, #1002, #1003):

From PR #1001 (Fix release readiness issues for 5.x):

  • Fix copy-paste bug in Migrator::shouldDropTables() using $messages['down'] instead of $messages['missing']
  • Fix uninitialized $command property in Migrations.php
  • Fix weak equality in Table::saveData() (use !== instead of !=)
  • Replace assert() with explicit RuntimeException in BaseSeed for production safety (assertions can be disabled in production)
  • Fix DumpCommand using non-existent $io->error() method (should be $io->err())
  • Replace unsafe addslashes() with proper driver escaping (schemaValue()) for column comments in MysqlAdapter::getRenameColumnInstructions()

From PR #1002 (Quote database names in PostgreSQL and SQL Server adapters):

  • PostgresAdapter: Quote database name and charset in createDatabase()
  • PostgresAdapter: Quote database name in dropDatabase()
  • SqlserverAdapter: Use quoteSchemaName() instead of manual brackets in createDatabase() and dropDatabase()
  • SqlserverAdapter: Fix SQL injection vulnerability in dropDatabase()

From PR #1003 (Improve SQL quoting and fix docblock issues):

  • SqlserverAdapter: Use quoteString() for sp_rename parameters in getRenameTableInstructions() and getRenameColumnInstructions()
  • PostgresAdapter/SqlserverAdapter: Use quoteColumnName() for foreign key column definitions instead of hard-coded double quotes

Given that 5.x requires Cake5.3+ it seems important to have the gap on bugs a bit smaller between those major versions of migrations.

This backports several important bug fixes from recent 5.x PRs:

**From PR #1001 (Fix release readiness issues for 5.x):**

- Fix copy-paste bug in Migrator::shouldDropTables() using $messages['down']
  instead of $messages['missing']
- Fix uninitialized $command property in Migrations.php
- Fix weak equality in Table::saveData() (use !== instead of !=)
- Replace assert() with explicit RuntimeException in BaseSeed for
  production safety
- Fix DumpCommand using non-existent $io->error() method (should be $io->err())
- Replace unsafe addslashes() with proper driver escaping (schemaValue())
  for column comments in MysqlAdapter::getRenameColumnInstructions()

**From PR #1002 (Quote database names in PostgreSQL and SQL Server adapters):**

- PostgresAdapter: Quote database name and charset in createDatabase()
- PostgresAdapter: Quote database name in dropDatabase()
- SqlserverAdapter: Use quoteSchemaName() instead of manual brackets in
  createDatabase() and dropDatabase()
- SqlserverAdapter: Fix SQL injection vulnerability in dropDatabase()

**From PR #1003 (Improve SQL quoting and fix docblock issues):**

- SqlserverAdapter: Use quoteString() for sp_rename parameters in
  getRenameTableInstructions() and getRenameColumnInstructions()
- PostgresAdapter/SqlserverAdapter: Use quoteColumnName() for foreign key
  column definitions instead of hard-coded double quotes
@dereuromark dereuromark added this to the 4.x (CakePHP 5) milestone Jan 20, 2026
@cakephp cakephp deleted a comment Jan 20, 2026
@markstory markstory merged commit 94500da into 4.x Jan 21, 2026
13 checks passed
@markstory markstory deleted the fix/backport-5x-bugfixes branch January 21, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants