Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelogs/v4.7.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Release Date: Unreleased

## Bugs Fixed

- **Database:** Fixed a bug where `SQLite3\Table::dropIndexes()` used single-quoted string literals instead of escaped identifiers in `DROP INDEX IF EXISTS`, causing syntax errors on index names containing quotes or special characters.
- **Security:** Fixed a bug where `Security::__construct()` threw a `TypeError` when the CSRF cookie was an array, causing an HTTP 500 response for affected requests.
- **Worker Mode:** Fixed a bug where every request that ended with an uncaught exception, including a `404 Page Not Found` without a 404 override, called `exit()` in the exception handler. This ended the worker script, so FrankenPHP booted a new one, and the worker loop skipped its cleanup after the request. The exception handler now returns to the worker loop.

Expand Down
2 changes: 1 addition & 1 deletion system/Database/SQLite3/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ protected function dropIndexes()
continue;
}

$this->db->query("DROP INDEX IF EXISTS '{$name}'");
$this->db->query('DROP INDEX IF EXISTS ' . $this->db->escapeIdentifiers($name));
}
}
}
15 changes: 15 additions & 0 deletions tests/system/Database/Live/SQLite3/AlterTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,21 @@ public function testDropColumnKeepsForeignKeyTableNameWhenPrefixIsSet(): void
$forge->dropTable('bandit_fk', true);
}

public function testDropIndexesWithSpecialIndexName(): void
{
$this->createTable('special_table');
$this->db->query("CREATE INDEX `special'index` ON `special_table`(`name`)");

$result = $this->table
->fromTable('special_table')
->dropColumn('email')
->run();

$this->assertTrue($result);
$this->forge->dropTable('special_table', true);
$this->forge->dropTable('special_table_fk', true);
}

protected function createTable(string $tableName = 'foo'): void
{
// Create support table for foreign keys
Expand Down
Loading