summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-11-03 20:55:01 +0000
committerFelipe Pena <felipe@php.net>2008-11-03 20:55:01 +0000
commitfc53f0b6ea40e774c5bff55420632726b13aa226 (patch)
tree20628ef17628bb85d67c12729ebb93c9adf7fed3
parent3591f8b3564356801fc9ed40e47f829c282fab47 (diff)
downloadphp-git-fc53f0b6ea40e774c5bff55420632726b13aa226.tar.gz
MFH:
- Fixed endless loop in PDOStatement::debugDumpParams() patch by: Jonah H. Harris <jonah.harris at gmail dot com>
-rw-r--r--NEWS2
-rwxr-xr-xext/pdo/pdo_stmt.c1
-rw-r--r--ext/pdo_sqlite/tests/debugdumpparams_001.phpt31
3 files changed, 34 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 88aa960445..09c86a3bbe 100644
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,8 @@ PHP NEWS
filter). (Arnaud)
- Fixed bug #42294 (Unified solution for round() based on C99 round). (Ilia)
+- Fixed endless loop in PDOStatement::debugDumpParams().
+ (jonah.harris at gmail dot com)
- Fixed ability to use "internal" heaps in extensions. (Arnaud, Dmitry)
- Fixed weekdays adding/subtracting algorithm. (Derick)
- Fixed some ambiguities in the date parser. (Derick)
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 431da1ab94..20dd0b6c20 100755
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2189,6 +2189,7 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
param->is_param,
param->param_type);
+ zend_hash_move_forward_ex(stmt->bound_params, &pos);
}
}
diff --git a/ext/pdo_sqlite/tests/debugdumpparams_001.phpt b/ext/pdo_sqlite/tests/debugdumpparams_001.phpt
new file mode 100644
index 0000000000..d85784a4f1
--- /dev/null
+++ b/ext/pdo_sqlite/tests/debugdumpparams_001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Testing PDOStatement::debugDumpParams() with bound params
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
+?>
+--FILE--
+<?php
+
+$db = new pdo('sqlite:memory');
+
+$x= $db->prepare('select :a, :b');
+$x->bindValue(':a', 1, PDO::PARAM_INT);
+$x->bindValue(':b', 'foo');
+var_dump($x->debugDumpParams());
+
+?>
+--EXPECT--
+SQL: [13] select :a, :b
+Params: 2
+Key: Position #0:
+paramno=-1
+name=[2] :a
+is_param=1
+param_type=1
+Key: Position #0:
+paramno=-1
+name=[2] :b
+is_param=1
+param_type=2
+NULL