|
| 1 | +--TEST-- |
| 2 | +Bug #78241 (touch() does not handle dates after 2038 in PHP 64-bit) |
| 3 | +--SKIPIF-- |
| 4 | +<?php |
| 5 | +if (substr(PHP_OS, 0, 3) != 'WIN') die('skip this test is for Windows platforms only'); |
| 6 | +if (PHP_INT_SIZE != 8) die('skip this test is for 64bit platforms only'); |
| 7 | +?> |
| 8 | +--INI-- |
| 9 | +date.timezone=UTC |
| 10 | +--FILE-- |
| 11 | +<?php |
| 12 | +$filename = __DIR__ . '/bug78241.txt'; |
| 13 | +for ($i = 2037; $i <= 2040; $i++) { |
| 14 | + $t = mktime(1, 1 , 1, 1, 1, $i); |
| 15 | + echo 'Date: '.date('D, d M Y H:i:s', $t), PHP_EOL; |
| 16 | + touch($filename, $t); |
| 17 | + clearstatcache(true, $filename); |
| 18 | + $file = filemtime($filename); |
| 19 | + echo 'File: '.date('D, d M Y H:i:s', $file), PHP_EOL, PHP_EOL; |
| 20 | +} |
| 21 | +?> |
| 22 | +--EXPECT-- |
| 23 | +Date: Thu, 01 Jan 2037 01:01:01 |
| 24 | +File: Thu, 01 Jan 2037 01:01:01 |
| 25 | + |
| 26 | +Date: Fri, 01 Jan 2038 01:01:01 |
| 27 | +File: Fri, 01 Jan 2038 01:01:01 |
| 28 | + |
| 29 | +Date: Sat, 01 Jan 2039 01:01:01 |
| 30 | +File: Sat, 01 Jan 2039 01:01:01 |
| 31 | + |
| 32 | +Date: Sun, 01 Jan 2040 01:01:01 |
| 33 | +File: Sun, 01 Jan 2040 01:01:01 |
0 commit comments