ID: 47177 Updated by: j...@php.net Reported By: dmitrysp at yandex dot ru -Status: Open +Status: Bogus Bug Type: *Directory/Filesystem functions Operating System: WinXP, W2k PHP Version: 5.2.8 New Comment:
Set the proper timezone in your php.ini. There is no bug here. Previous Comments: ------------------------------------------------------------------------ [2009-01-21 08:53:37] dmitrysp at yandex dot ru 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 this bug report at http://bugs.php.net/?id=47177&edit=1