[php-src] PHP-8.6: ext/pdo: Return false from rewrite_name_to_position() on IM001 error
| From: | Ilia Alshanetsky | Date: | Tue, 06 Oct 2026 00:16:41 +0000 |
| Subject: | [php-src] PHP-8.6: ext/pdo: Return false from rewrite_name_to_position() on IM001 error | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141986@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-10-05T20:02:29-04:00
Commit: https://github.com/php/php-src/commit/073095ed8d9a29c014aec50b98765909a979bb0b
Raw diff: https://github.com/php/php-src/commit/073095ed8d9a29c014aec50b98765909a979bb0b.diff
ext/pdo: Return false from rewrite_name_to_position() on IM001 error
rewrite_name_to_position() returns bool, so the -1 returned after raising
IM001 for a named parameter repeated across positions converted to true,
and really_register_bound_param() never saw the failure.
Closes GH-23465
Changed paths:
M ext/pdo/pdo_stmt.c
Diff:
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index b5b743514191..52a75010bb23 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -76,7 +76,7 @@ static inline bool rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_p
if (param->paramno >= 0) {
/* TODO Error? */
pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "PDO refuses to handle
repeating the same :named parameter for multiple positions with this driver, as it might be unsafe
to do so. Consider using a separate name for each parameter instead");
- return -1;
+ return false;
}
param->paramno = position;
return 1;