bug48909.phpt 1.4 KB

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