Fix undefined array key 'origin' on older SQLite versions#19218
Fix undefined array key 'origin' on older SQLite versions#19218
Conversation
The 'origin' column in PRAGMA index_list was added in SQLite 3.8.9. Users on older SQLite versions get undefined array key warnings. Use null coalescing to handle missing key gracefully. The existing fallback logic already handles primary key detection when origin is not available. Fixes #19216
|
We don't support 10 year old versions of other databases, why would we do that for sqlite? |
|
Is there a different way a user would run into this issue? Or do we somehow technically prevent oder installs to be used? |
|
We just need to document the supported version in the docs, like it's done for other DBMSs. cakephp/docs#8155 |
|
Also fine, but in the end having it nullable without warning is also quite free of maintenance and future tickets :) |
|
I doubt tickets from users using over a decade old SQLite version will be a common occurrence. |
|
Instead of a silent fallback we could also throw a speaking exception with a clear error message to upgrade, of course. |
|
Generally I would agree with @markstory and @ADmad, that "adding" support for a >10 year old sqlite version is not what we want to do. But looking at what this fix is actually about (just making sure the array key exists, which is generally a good idea) I think this is fine 👍🏻 |
Summary
origincolumn inPRAGMA index_listwas added in SQLite 3.8.9 (April 2015)The fix uses null coalescing (
$row['origin'] ?? null) to handle the missing key gracefully. The existing fallback logic indescribeIndexes()already handles primary key detection when theorigincolumn is not available.Fixes #19216