gh7837.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Bug GH-7837 (large bigints may be truncated)
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once 'skipifconnectfailure.inc';
  8. if (!$IS_MYSQLND) {
  9. die("skip requires mysqlnd");
  10. }
  11. ?>
  12. --FILE--
  13. <?php
  14. require_once "connect.inc";
  15. $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
  16. $mysql->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true);
  17. $mysql->query("DROP TABLE IF EXISTS test");
  18. $mysql->query("CREATE TABLE test (`ubigint` bigint unsigned NOT NULL) ENGINE=InnoDB");
  19. $mysql->query("INSERT INTO test (`ubigint`) VALUES (18446744073709551615)");
  20. $mysql->query("INSERT INTO test (`ubigint`) VALUES (9223372036854775808)");
  21. $mysql->query("INSERT INTO test (`ubigint`) VALUES (1)");
  22. $result = $mysql->query("SELECT ubigint FROM test");
  23. var_dump($result->fetch_all());
  24. ?>
  25. --CLEAN--
  26. <?php
  27. require_once "clean_table.inc";
  28. ?>
  29. --EXPECT--
  30. array(3) {
  31. [0]=>
  32. array(1) {
  33. [0]=>
  34. string(20) "18446744073709551615"
  35. }
  36. [1]=>
  37. array(1) {
  38. [0]=>
  39. string(19) "9223372036854775808"
  40. }
  41. [2]=>
  42. array(1) {
  43. [0]=>
  44. int(1)
  45. }
  46. }