bug55653.phpt 947 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Bug #55653 PS crash with libmysql when binding same variable as param and out
  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. $in_and_out = "a";
  15. if (!($stmt = $link->stmt_init()))
  16. printf("[002] [%d] %s\n", $link->errno, $link->error);
  17. if (!($stmt->prepare("SELECT ?")) ||
  18. !($stmt->bind_param("s", $in_and_out)) ||
  19. !($stmt->execute()) ||
  20. !($stmt->bind_result($in_and_out)))
  21. printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
  22. if (!$stmt->fetch())
  23. printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
  24. if ("a" !== $in_and_out)
  25. printf("[005] Wrong result: '%s'\n", $in_and_out);
  26. echo "done!";
  27. ?>
  28. --EXPECT--
  29. done!