summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2005-07-11 14:14:56 +0000
committerAndrey Hristov <andrey@php.net>2005-07-11 14:14:56 +0000
commitb3aa24ff986d788acfa01004d6887ed6b47b7f8c (patch)
treee5326b0dfcafdf71c23b3353f29db3c32c2d3450
parent97499262242f01eeee968fe69de461f5b2569cff (diff)
downloadphp-git-b3aa24ff986d788acfa01004d6887ed6b47b7f8c.tar.gz
fix a segfault with the following script:
<?php $dbh = new PDO('mysql:dbname=test;host=localhost', "root", "secret"); $what = 1; $stmt = $dbh->prepare('select a, b, c from t123 where a=:what'); $stmt->bindParam(1, $what, PDO_PARAM_INT, 12); var_dump($stmt->execute()); var_dump($stmt->fetchObject()); ?>
-rwxr-xr-xext/pdo/pdo_stmt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index c6e4b481a5..830e052542 100755
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -91,7 +91,10 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa
/* this is not an error here */
return 1;
}
-
+ if (!param->name) {
+ return 1;
+ }
+
zend_hash_internal_pointer_reset(stmt->bound_param_map);
while (SUCCESS == zend_hash_get_current_data(stmt->bound_param_map, (void**)&name)) {
if (strcmp(name, param->name)) {