Skip to content

ext/pdo_pgsql: dangling running statement after a failed query(). - #25841

Open
devnexen wants to merge 1 commit into
php:PHP-8.5from
devnexen:gh25838
Open

devnexen wants to merge 1 commit into
php:PHP-8.5from
devnexen:gh25838

Conversation

@devnexen

Copy link
Copy Markdown
Member

PDO::query() detaches the handle from a failed statement before releasing it, so pgsql_stmt_dtor() skipped clearing H->running_stmt and the connection kept a pointer to the freed statement that the next lazy query dereferenced in pgsql_stmt_finish(). Clear it as well when the handle is merely detached; an already destroyed handle (bug72294) is still left untouched.

Fix GH-25838

PDO::query() detaches the handle from a failed statement before releasing it,
so pgsql_stmt_dtor() skipped clearing H->running_stmt and the connection kept a
pointer to the freed statement that the next lazy query dereferenced in
pgsql_stmt_finish(). Clear it as well when the handle is merely detached; an
already destroyed handle (bug72294) is still left untouched.

Fix phpGH-25838
@devnexen
devnexen marked this pull request as ready for review November 27, 2026 17:01

@iliaal iliaal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks right

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.

2 participants