bug35517.phpt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. --TEST--
  2. Bug #35517 (mysqli_stmt_fetch returns NULL)
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once('skipifconnectfailure.inc');
  8. ?>
  9. --FILE--
  10. <?php
  11. require_once("connect.inc");
  12. $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
  13. $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)");
  14. $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)");
  15. $stmt = $mysql->prepare("SELECT id FROM temp");
  16. $stmt->execute();
  17. $stmt->bind_result($id);
  18. while ($stmt->fetch()) {
  19. if (PHP_INT_SIZE == 8) {
  20. if ((gettype($id) !== 'int') && (gettype($id) != 'integer'))
  21. printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true));
  22. } else {
  23. if (gettype($id) !== 'string') {
  24. printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true));
  25. }
  26. }
  27. print $id;
  28. print "\n";
  29. }
  30. $stmt->close();
  31. $mysql->query("DROP TABLE temp");
  32. $mysql->close();
  33. print "done!";
  34. ?>
  35. --CLEAN--
  36. <?php
  37. require_once("connect.inc");
  38. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
  39. printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
  40. if (!mysqli_query($link, "DROP TABLE IF EXISTS temp"))
  41. printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  42. mysqli_close($link);
  43. ?>
  44. --EXPECT--
  45. 3000000897
  46. 3800001532
  47. 3900002281
  48. 3100059612
  49. done!