bug55653.phpt 982 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Bug #55653 PS crash with libmysql when binding same variable as param and out
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once('skipifconnectfailure.inc');
  8. ?>
  9. --FILE--
  10. <?php
  11. require_once("connect.inc");
  12. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
  13. printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
  14. }
  15. $in_and_out = "a";
  16. if (!($stmt = $link->stmt_init()))
  17. printf("[002] [%d] %s\n", $link->errno, $link->error);
  18. if (!($stmt->prepare("SELECT ?")) ||
  19. !($stmt->bind_param("s", $in_and_out)) ||
  20. !($stmt->execute()) ||
  21. !($stmt->bind_result($in_and_out)))
  22. printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
  23. if (!$stmt->fetch())
  24. printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
  25. if ("a" !== $in_and_out)
  26. printf("[005] Wrong result: '%s'\n", $in_and_out);
  27. echo "done!";
  28. ?>
  29. --EXPECT--
  30. done!