bug80837.phpt 930 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Bug #80837 Calling stmt_store_result after fetch doesn't throw an error
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once 'skipifconnectfailure.inc';
  8. if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
  9. ?>
  10. --FILE--
  11. <?php
  12. require_once "connect.inc";
  13. mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
  14. $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
  15. $mysqli->query('DROP TABLE IF EXISTS test');
  16. $mysqli->query('CREATE TABLE test (b int)');
  17. $mysqli->query('INSERT INTO test VALUES (1),(2),(3)');
  18. $statement = $mysqli->prepare("SELECT b FROM test");
  19. $statement->execute();
  20. $statement->bind_result($name);
  21. $statement->fetch();
  22. try {
  23. $statement->store_result();
  24. } catch (mysqli_sql_exception $e) {
  25. echo $e->getMessage();
  26. }
  27. $mysqli->close();
  28. ?>
  29. --CLEAN--
  30. <?php
  31. require_once "clean_table.inc";
  32. ?>
  33. --EXPECT--
  34. Commands out of sync; you can't run this command now