From: dmitrysp at yandex dot ru Operating system: WinXP, W2k PHP version: 5.2.8 PHP Bug Type: *Directory/Filesystem functions Bug description: touch(<file>, <time - bug here>)
Description: ------------ Incorrect second argument in touch() on winter/summer time Reproduce code: --------------- go1.php <? echo "Current winter-time (Moscow +3 GTM): ".date("r (T)")." ".phpversion()."\r\n"; touch("1.txt", mktime(3,0,0,6,1,2008)); clearstatcache(); $t1=filemtime("1.txt"); echo "file1: ".date("d/m/Y H:i:s",$t1)." (must be 3:00)\r\n"; touch("2.txt", mktime(12,0,0,1,2,2009)); clearstatcache(); $t2=filemtime("2.txt"); echo "file2: ".date("d/m/Y H:i:s",$t2)." (must be 12:00)\r\n"; ?> go2.php <? echo "Current winter-time (Moscow +3 GTM): ".date("r (T)")." ".phpversion()."\r\n"; touch("1.txt", mktime(mt_rand(0,23),mt_rand(0,59),0,6,1,2008,mt_rand(0,1))); copy("1.txt", "2.txt"); clearstatcache(); $t1=filemtime("1.txt"); touch("2.txt", $t1); clearstatcache(); $t2=filemtime("2.txt"); echo "file1: ".date("d/m/Y H:i:s",$t1)."\r\n"; echo "file2: ".date("d/m/Y H:i:s",$t2)." (file1 must be equal file2)\r\n"; ?> Expected result: ---------------- ========== (1) Windows XP, PHP 5.1.6, go1.php Current winter-time (Moscow +3 GTM): Wed, 21 Jan 2009 11:01:13 +0300 (MSK) 5.1.6 file1: 01/06/2008 03:00:00 (must be 3:00) file2: 02/01/2009 12:00:00 (must be 12:00) ========== (2) Windows XP, PHP 5.2.8, go1.php Current winter-time (Moscow +3 GTM): Wed, 21 Jan 2009 11:01:26 +0300 (MSK) 5.2.8 file1: 01/06/2008 04:00:00 (must be 3:00) file2: 02/01/2009 12:00:00 (must be 12:00) ========== (3) Windows 2000, PHP 5.2.8, go1.php Current winter-time (Moscow +3 GTM): Wed, 21 Jan 2009 11:04:59 +0300 (MSK) 5.2.8 file1: 01/06/2008 04:00:00 (must be 3:00) file2: 02/01/2009 12:00:00 (must be 12:00) ========== (4) Windows 2000, PHP 5.2.6, go1.php Current winter-time (Moscow +3 GTM): Wed, 21 Jan 2009 11:07:14 +0300 (MSK) 5.2.6 file1: 01/06/2008 04:00:00 (must be 3:00) file2: 02/01/2009 12:00:00 (must be 12:00) ========== (5) Windows XP, PHP 5.2.6, go1.php Current winter-time (Moscow +3 GTM): Wed, 21 Jan 2009 11:11:04 +0300 (MSK) 5.2.6 file1: 01/06/2008 04:00:00 (must be 3:00) file2: 02/01/2009 12:00:00 (must be 12:00) ========== (6) Windows XP, PHP 4.4.2, go1.php Current winter-time (Moscow +3 GTM): Wed, 21 Jan 2009 11:12:53 +0300 (Ìîñêîâñêîå âðåìÿ (çèìà)) 4.4.2 file1: 01/06/2008 03:00:00 (must be 3:00) file2: 02/01/2009 12:00:00 (must be 12:00) ========== (7) Windows XP, PHP 3.0.17, go1.php Current winter-time (Moscow +3 GTM): r (╠þ¸úþò¸úþõ ò¨õü (÷øüð)) 3.0.17 file1: 01/06/2008 03:00:00 (must be 3:00) file2: 02/01/2009 12:00:00 (must be 12:00) --------------------------------------------------- Command `dir 1.txt`: 01.06.2008 03:00 0 1.txt --------------------------------------------------- Windows XP, PHP 5.1.6, go2.php Current winter-time (Moscow +3 GTM): Wed, 21 Jan 2009 11:23:15 +0300 (MSK) 5.2.8 file1: 01/06/2008 18:26:00 file2: 01/06/2008 19:26:00 (file1 must be equal file2) Actual result: -------------- go1.php file1: 01/06/2008 03:00:00 (must be 3:00) go2.php filemtime(1.txt) must be equal filemtime(2.txt), after copy(1.txt, 2.txt). Shell command "copy 1.txt 2.txt" is correct. And in PHP 4.x/3.x all ok. I need downgrade? .-) -- Edit bug report at http://bugs.php.net/?id=47177&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47177&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47177&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47177&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47177&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47177&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47177&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47177&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47177&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47177&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47177&r=support Expected behavior: http://bugs.php.net/fix.php?id=47177&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47177&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47177&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47177&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47177&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47177&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47177&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47177&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47177&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47177&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47177&r=mysqlcfg