bug62046.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
  3. --SKIPIF--
  4. <?php
  5. require_once('skipif.inc');
  6. require_once('skipifconnectfailure.inc');
  7. ?>
  8. --FILE--
  9. <?php
  10. require_once("connect.inc");
  11. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
  12. printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
  13. }
  14. if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
  15. printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  16. }
  17. if (FALSE === $stmt->execute()) {
  18. printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
  19. }
  20. if (FALSE === $stmt->store_result()) {
  21. printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
  22. }
  23. $one = NULL;
  24. if (FALSE === $stmt->bind_result($one)) {
  25. printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
  26. }
  27. if (FALSE === $stmt->reset()) {
  28. printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
  29. }
  30. while ($stmt->fetch()) {
  31. var_dump($one);
  32. }
  33. $stmt->close();
  34. $link->close();
  35. echo "done!";
  36. ?>
  37. --EXPECT--
  38. int(42)
  39. done!