Repository navigation
Conversation
Every PDO object attached to a persistent connection shares one pdo_dbh_t, and dbh_get_gc() reported the driver's GC data once per object. pdo_sqlite holds each user function, aggregate and collation callback once, so with two or more objects the collector subtracted more references than exist and freed live closures, crashing or returning wrong results. Report driver GC data only while a single object owns the handle, the same refcount check the rollback guard uses since phpGH-23962. While the connection is shared, cycles through those callbacks are left to request shutdown, as they already are with GC disabled. No other bundled driver implements get_gc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PDO reported shared driver callbacks to the GC once per PDO object despite owning only one reference, so two live PDO objects sharing a persistent SQLite connection could free callbacks still in use. Driver callbacks are now reported only when one object owns the connection; cycles through them remain uncollected while it is shared. SQLite is the only bundled driver with this GC hook. Found while testing #24041; verified with pdo_sqlite on PHP-8.4 debug NTS and under valgrind.