bug77243-002.phpt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --TEST--
  2. Bug #77243 (Weekdays are calculated incorrectly for negative years)
  3. --SKIPIF--
  4. <?php if (PHP_INT_SIZE != 8) die("skip 64-bit only"); ?>
  5. --FILE--
  6. <?php
  7. date_default_timezone_set('UTC');
  8. $startingPoints = [
  9. -62167046400 - (((101 * 365) + 25) * 86400),
  10. -62167046400 - (((100 * 365) + 25) * 86400),
  11. -62167046400 - ((( 99 * 365) + 25) * 86400),
  12. ];
  13. foreach ($startingPoints as $startingPoint)
  14. {
  15. for ($i = -7; $i < 7; $i++ )
  16. {
  17. echo date('Y-m-d o-W-N', $startingPoint + ($i * 86400)), "\n";
  18. }
  19. echo "\n\n";
  20. }
  21. ?>
  22. --EXPECT--
  23. -0102-12-26 -102-52-1
  24. -0102-12-27 -102-52-2
  25. -0102-12-28 -102-52-3
  26. -0102-12-29 -102-52-4
  27. -0102-12-30 -102-52-5
  28. -0102-12-31 -102-52-6
  29. -0101-01-01 -102-52-7
  30. -0101-01-02 -101-01-1
  31. -0101-01-03 -101-01-2
  32. -0101-01-04 -101-01-3
  33. -0101-01-05 -101-01-4
  34. -0101-01-06 -101-01-5
  35. -0101-01-07 -101-01-6
  36. -0101-01-08 -101-01-7
  37. -0101-12-26 -101-52-2
  38. -0101-12-27 -101-52-3
  39. -0101-12-28 -101-52-4
  40. -0101-12-29 -101-52-5
  41. -0101-12-30 -101-52-6
  42. -0101-12-31 -101-52-7
  43. -0100-01-01 -100-01-1
  44. -0100-01-02 -100-01-2
  45. -0100-01-03 -100-01-3
  46. -0100-01-04 -100-01-4
  47. -0100-01-05 -100-01-5
  48. -0100-01-06 -100-01-6
  49. -0100-01-07 -100-01-7
  50. -0100-01-08 -100-02-1
  51. -0100-12-26 -100-52-3
  52. -0100-12-27 -100-52-4
  53. -0100-12-28 -100-52-5
  54. -0100-12-29 -100-52-6
  55. -0100-12-30 -100-52-7
  56. -0100-12-31 -99-01-1
  57. -0099-01-01 -99-01-2
  58. -0099-01-02 -99-01-3
  59. -0099-01-03 -99-01-4
  60. -0099-01-04 -99-01-5
  61. -0099-01-05 -99-01-6
  62. -0099-01-06 -99-01-7
  63. -0099-01-07 -99-02-1
  64. -0099-01-08 -99-02-2