Skip to content

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

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

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

Conversation

@iliaal

@iliaal iliaal commented Aug 5, 2026

Copy link
Copy Markdown
Owner

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.

@iliaal
iliaal force-pushed the fix/pdo-setfetchmode-atomic branch 2 times, most recently from bf329d6 to 5209f7f Compare August 5, 2026 12:27
@iliaal iliaal changed the title Keep prior PDO fetch mode when setFetchMode validation fails Make PDOStatement::setFetchMode() updates atomic Aug 5, 2026
@iliaal
iliaal force-pushed the fix/pdo-setfetchmode-atomic branch from 5209f7f to 54c43f7 Compare August 5, 2026 12:39
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
@iliaal
iliaal force-pushed the fix/pdo-setfetchmode-atomic branch from 54c43f7 to d97dae6 Compare August 9, 2026 14:33
@iliaal

iliaal commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Promoted upstream: php#23188

@iliaal iliaal closed this Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant