unsigned_bigint.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Bug GH-7837 (large bigints may be truncated)
  3. --EXTENSIONS--
  4. pdo
  5. pdo_mysql
  6. mysqlnd
  7. --SKIPIF--
  8. <?php
  9. require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  10. MySQLPDOTest::skip();
  11. if (!MySQLPDOTest::isPDOMySQLnd()) die('skip only for mysqlnd');
  12. ?>
  13. --FILE--
  14. <?php
  15. require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  16. $pdo = MySQLPDOTest::factory();
  17. $tbl = "test";
  18. $pdo->query("DROP TABLE IF EXISTS $tbl");
  19. $pdo->query("CREATE TABLE $tbl (`ubigint` bigint unsigned NOT NULL) ENGINE=InnoDB");
  20. $pdo->query("INSERT INTO $tbl (`ubigint`) VALUES (18446744073709551615)");
  21. $pdo->query("INSERT INTO $tbl (`ubigint`) VALUES (9223372036854775808)");
  22. $pdo->query("INSERT INTO $tbl (`ubigint`) VALUES (1)");
  23. $result = $pdo->query("SELECT ubigint FROM $tbl")->fetchAll(PDO::FETCH_ASSOC);
  24. var_dump($result);
  25. ?>
  26. --CLEAN--
  27. <?php
  28. require dirname(__FILE__) . '/mysql_pdo_test.inc';
  29. MySQLPDOTest::dropTestTable();
  30. ?>
  31. --EXPECT--
  32. array(3) {
  33. [0]=>
  34. array(1) {
  35. ["ubigint"]=>
  36. string(20) "18446744073709551615"
  37. }
  38. [1]=>
  39. array(1) {
  40. ["ubigint"]=>
  41. string(19) "9223372036854775808"
  42. }
  43. [2]=>
  44. array(1) {
  45. ["ubigint"]=>
  46. int(1)
  47. }
  48. }