Skip to content

Return false from rewrite_name_to_position() on IM001 error path - #23465

Open
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/pdo-rewrite-name-im001-84
Open

Return false from rewrite_name_to_position() on IM001 error path#23465
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:fix/pdo-rewrite-name-im001-84

Conversation

@iliaal

@iliaal iliaal commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

rewrite_name_to_position() is declared bool, so the -1 returned after raising the IM001 error for a repeated :named parameter was converted to true and the caller's failure check never saw the failure, leaving bindParam() and bindColumn() reporting success despite the error. Returning false makes the error propagate; no other -1 return remains in the function.

@jorgsowa

Copy link
Copy Markdown
Contributor

Does it make sense to add regression test for it?

rewrite_name_to_position() returns bool, so the previous -1 was
converted to true and the caller's failure check never triggered after
raising the IM001 error for a repeated named parameter, leaving
bindParam()/bindColumn() reporting success. Sibling audit: no other -1
return remains in this function; the other error paths already return 0.
@iliaal
iliaal force-pushed the fix/pdo-rewrite-name-im001-84 branch from f451d5a to ec5fbc2 Compare August 26, 2026 21:26
@iliaal

iliaal commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

No. The IM001 return is not reached from bindParam or bindValue: the loop returns on the first matching name, so paramno is never already set. bindColumn does not call rewrite_name_to_position.

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