Skip to content

Comments

Fix undefined array key 'origin' on older SQLite versions#19218

Merged
markstory merged 2 commits into5.xfrom
fix-sqlite-origin-key-19216
Feb 16, 2026
Merged

Fix undefined array key 'origin' on older SQLite versions#19218
markstory merged 2 commits into5.xfrom
fix-sqlite-origin-key-19216

Conversation

@dereuromark
Copy link
Member

Summary

  • Fix undefined array key "origin" warning on SQLite versions < 3.8.9
  • The origin column in PRAGMA index_list was added in SQLite 3.8.9 (April 2015)
  • Users on older SQLite versions (e.g., shared hosting environments) get warnings

The fix uses null coalescing ($row['origin'] ?? null) to handle the missing key gracefully. The existing fallback logic in describeIndexes() already handles primary key detection when the origin column is not available.

Fixes #19216

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
@dereuromark dereuromark added this to the 5.3.2 milestone Jan 25, 2026
@markstory
Copy link
Member

We don't support 10 year old versions of other databases, why would we do that for sqlite?

@dereuromark
Copy link
Member Author

Is there a different way a user would run into this issue? Or do we somehow technically prevent oder installs to be used?

@ADmad
Copy link
Member

ADmad commented Jan 26, 2026

We just need to document the supported version in the docs, like it's done for other DBMSs. cakephp/docs#8155

@dereuromark
Copy link
Member Author

Also fine, but in the end having it nullable without warning is also quite free of maintenance and future tickets :)

@ADmad
Copy link
Member

ADmad commented Jan 26, 2026

I doubt tickets from users using over a decade old SQLite version will be a common occurrence.

@dereuromark
Copy link
Member Author

Instead of a silent fallback we could also throw a speaking exception with a clear error message to upgrade, of course.
If that is something you prefer.
Having a warning without any info seems like the inferior option of all 3.

@LordSimal
Copy link
Contributor

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 👍🏻

@markstory markstory merged commit bb3900e into 5.x Feb 16, 2026
14 of 15 checks passed
@markstory markstory deleted the fix-sqlite-origin-key-19216 branch February 16, 2026 16:49
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.

SqliteSchemaDialect - key "origin"

4 participants