Skip to content

Commit fd3fa9b

Browse files
committed
Fixed Bug #66043 (Segfault calling bind_param() on mysqli)
Although the doc said it is (unsigned int *), but it is ulong* in the libmysql 5.0 's source codes
1 parent 224dc52 commit fd3fa9b

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2013, PHP 5.4.23
4+
5+
- MySQLi:
6+
. Fixed bug #66043 (Segfault calling bind_param() on mysqli). (Laruence)
7+
48
- PDO
59
. Fixed bug 65946 (sql_parser permanently converts values bound to strings)
610

ext/mysqli/mysqli_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc,
384384
/* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */
385385
my_bool tmp;
386386
#else
387-
uint tmp = 0;
387+
ulong tmp = 0;
388388
#endif
389389
stmt->result.buf[ofs].type = IS_STRING;
390390
/*

ext/mysqli/tests/bug66043.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug #66043 (Segfault calling bind_param() on mysqli)
3+
--SKIPIF--
4+
<?php
5+
require_once('skipif.inc');
6+
require_once("connect.inc");
7+
if ($IS_MYSQLND) {
8+
die("skip libmysql only test");
9+
}
10+
require_once('skipifconnectfailure.inc');
11+
?>
12+
--FILE--
13+
<?php
14+
require 'connect.inc';
15+
$db = new mysqli($host, $user, $passwd, 'mysql');
16+
17+
$stmt = $db->stmt_init();
18+
$stmt->prepare("SELECT User FROM user WHERE password=\"\"");
19+
$stmt->execute();
20+
$stmt->bind_result($testArg);
21+
echo "Okey";
22+
?>
23+
--EXPECTF--
24+
Okey

0 commit comments

Comments
 (0)