bug77935.phpt 986 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Bug #77935: Crash in mysqlnd_fetch_stmt_row_cursor when calling an SP with a cursor
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once('skipifconnectfailure.inc');
  8. if (!$IS_MYSQLND) {
  9. die("skip mysqlnd only test");
  10. }
  11. ?>
  12. --FILE--
  13. <?php
  14. require_once(__DIR__ . '/connect.inc');
  15. mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
  16. $db = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
  17. $db->query('DROP PROCEDURE IF EXISTS testSp');
  18. $db->query(<<<'SQL'
  19. CREATE
  20. PROCEDURE `testSp`()
  21. BEGIN
  22. DECLARE `cur` CURSOR FOR SELECT 1;
  23. OPEN `cur`;
  24. CLOSE `cur`;
  25. SELECT 1;
  26. END;
  27. SQL);
  28. $stmt = $db->prepare("CALL testSp()");
  29. $stmt->execute();
  30. $result = $stmt->get_result();
  31. while ($row = $result->fetch_assoc()) {
  32. var_dump($row);
  33. }
  34. ?>
  35. --CLEAN--
  36. <?php
  37. require_once 'connect.inc';
  38. $link = new mysqli($host, $user, $passwd, $db, $port, $socket);
  39. $link->query('DROP PROCEDURE IF EXISTS testSp');
  40. $link->close();
  41. ?>
  42. --EXPECT--
  43. array(1) {
  44. [1]=>
  45. int(1)
  46. }