WordPress / WordPress/sqlite-database-integration
Decouple driver internals from PDO::ATTR_STRINGIFY_FETCHES
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 363
- Forks
- 67
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 7
Description
Problem
The MySQL-on-SQLite driver currently relies on PDO::ATTR_STRINGIFY_FETCHES being enabled for some of its internal metadata queries.
When stringification is disabled (the default for PDO SQLite), SQLite metadata values are returned as integers on current PHP versions. Several driver paths compare those values strictly against strings, so changing a public PDO fetch attribute can alter internal DDL and emulation behavior.
Known examples include:
- detecting temporary information-schema tables with
fetchColumn() === '1' - restoring
PRAGMA foreign_keysonly when its value is strictly'1' - interpreting
NON_UNIQUEonly when its value is strictly'0' - reconstructing columns and indexes by comparing
notnull,pk, anduniquemetadata to string values
This was observed while simplifying the driver API in #449. With PDO::ATTR_STRINGIFY_FETCHES disabled, translation tests failed because unique indexes were recreated as non-unique and foreign-key state handling was skipped.
WordPress and the MySQL binary protocol adapter may still choose to enable stringified fetches for their outward compatibility. The driver's internal correctness should not depend on that caller-facing setting.
Expected behavior
- Normalize or cast internal SQLite metadata independently of
PDO::ATTR_STRINGIFY_FETCHES. - Produce identical DDL, index, foreign-key, and information-schema behavior whether stringified fetches are enabled or disabled.
- Continue honoring
PDO::ATTR_STRINGIFY_FETCHESfor result values returned through the public PDO-compatible API. - Add coverage for both attribute states, including unique index reconstruction and foreign-key handling.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the MySQL-on-SQLite driver for the listed fetchColumn and metadata comparisons, then inspect the translation tests that exposed the failures. Exercise the relevant paths with PDO::ATTR_STRINGIFY_FETCHES enabled and disabled; done means identical DDL, index, foreign-key, and information-schema behavior while public result values still honor the attribute.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sqlite
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100