Skip to content

Make PDOStatement::setFetchMode() updates atomic - #23188

Open
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/pdo-setfetchmode-atomic
Open

Make PDOStatement::setFetchMode() updates atomic#23188
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/pdo-setfetchmode-atomic

Conversation

@iliaal

@iliaal iliaal commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PDOStatement::setFetchMode() discarded active FETCH_INTO or FETCH_CLASS state before validating its replacement. Validate the candidate in local storage, then replace the tagged-union payload and release the old state after a coherent commit. This preserves state on validation failure and makes autoload or destructor re-entry safe.

pdo_stmt_setup_fetch_mode() cleared active fetch state before validating the
replacement. Failed validation lost FETCH_INTO objects and FETCH_CLASS
constructor arguments; autoload re-entry could also observe a mismatched
tagged union.

Validate the candidate entirely in local storage. Only after validation
succeeds, replace the active payload and mode, and release the old payload
from a coherent state.

Closes phpGH-23188
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