mirror of
https://github.com/php/php-src.git
synced 2024-10-04 08:16:11 +00:00
d4afbd487a
Bug#62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset(). Stmt's state was changed to STMT_PREPARED and leads the driver to think that the stmt was just prepared. Because result set exist also for only prepared but not executed sets, the check for stmt->result isn't any good. There is a result set, because as response for COM_PREPARE the server sends metadata and metadata is part of a result set. After COM_EXECUTE the server sends metadata again, which could be different and in this case more correct.
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
--TEST--
|
|
Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
|
|
--SKIPIF--
|
|
<?php
|
|
require_once('skipif.inc');
|
|
require_once('skipifconnectfailure.inc');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
require_once("connect.inc");
|
|
|
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
|
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
|
}
|
|
if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
|
|
printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
|
}
|
|
if (FALSE === $stmt->execute()) {
|
|
printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
|
}
|
|
if (FALSE === $stmt->store_result()) {
|
|
printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
|
}
|
|
$one = NULL;
|
|
if (FALSE === $stmt->bind_result($one)) {
|
|
printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
|
}
|
|
if (FALSE === $stmt->reset()) {
|
|
printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
|
|
}
|
|
while ($stmt->fetch()) {
|
|
var_dump($one);
|
|
}
|
|
$stmt->close();
|
|
$link->close();
|
|
echo "done!";
|
|
?>
|
|
--EXPECT--
|
|
int(42)
|
|
done!
|