Skip to content

ext/pdo: Report bound params/columns to GC and fix driver_params refcount - #23845

Open
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:promote/pdo-getgc-boundparams
Open

iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:promote/pdo-getgc-boundparams

Conversation

@iliaal

@iliaal iliaal commented Sep 22, 2026

Copy link
Copy Markdown
Member

PDOStatement's get_gc handler never walked bound_params or bound_columns, so a reference cycle through a bindParam() or bindColumn() argument stayed invisible to the collector. register_bound_param() has also copied driver_params since 5b8d0dc while really_register_bound_param() added a reference of its own, leaving one zval with two references, so even a reported cycle could not be reclaimed. The test binds six objects with driver-option arguments and expects all six collected after gc_collect_cycles().

…ount

PDOStatement's get_gc handler never reported bound_params or bound_columns,
so reference cycles through bindParam()/bindColumn() arguments stayed
invisible to the collector, and since 5b8d0dc register_bound_param()
copied driver_params while really_register_bound_param() added another
reference, leaving one zval with two references that no collector could
reclaim. Report both hash tables, drop the extra addref, and release the
caller's reference on the registration failure path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant