int_overflow_64bit.phpt 632 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. testing integer overflow (64bit)
  3. --SKIPIF--
  4. <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
  5. --FILE--
  6. <?php
  7. $doubles = array(
  8. PHP_INT_MAX,
  9. PHP_INT_MAX + 1,
  10. PHP_INT_MAX + 1000,
  11. PHP_INT_MAX * 2 + 4,
  12. -PHP_INT_MAX -1,
  13. -PHP_INT_MAX -2,
  14. -PHP_INT_MAX -1000,
  15. );
  16. foreach ($doubles as $d) {
  17. $l = (int)$d;
  18. var_dump($l);
  19. }
  20. echo "Done\n";
  21. ?>
  22. --EXPECT--
  23. int(9223372036854775807)
  24. int(-9223372036854775808)
  25. int(-9223372036854775808)
  26. int(0)
  27. int(-9223372036854775808)
  28. int(-9223372036854775808)
  29. int(-9223372036854775808)
  30. Done