bug48909.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Bug #48909 (Segmentation fault in mysqli_stmt_execute)
  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] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  13. $host, $user, $db, $port, $socket);
  14. if (!$link->query("DROP TABLE IF EXISTS test") ||
  15. !$link->query(sprintf("CREATE TABLE test(id INT, label varchar(255)) ENGINE = %s", $engine)))
  16. printf("[002] [%d] %s\n", $link->errno, $link->error);
  17. if (!$stmt = $link->prepare("INSERT INTO test(id, label) VALUES (?, ?)"))
  18. printf("[003] [%d] %s\n", $link->errno, $link->error);
  19. if (!$stmt->bind_param("bb",$bvar, $bvar))
  20. printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
  21. if (!$stmt->execute()) {
  22. if ($stmt->errno != 1366) {
  23. /*
  24. $bvar is null, b is for BLOB - any error like this should be OK:
  25. 1366 - Incorrect integer value: '' for column 'id' at row 1
  26. */
  27. printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
  28. }
  29. }
  30. $stmt->close();
  31. $link->close();
  32. echo "done";
  33. ?>
  34. --CLEAN--
  35. <?php
  36. require_once("clean_table.inc");
  37. ?>
  38. --EXPECTF--
  39. done