|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78381 touch() with time-params does not set file modification date on Windows
Submitted: 2019-08-06 12:42 UTC Modified: 2019-08-06 15:31 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: andrey dot sperkach at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: *Directory/Filesystem functions
PHP Version: 7.3.8 OS: Windows x86
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: andrey dot sperkach at gmail dot com
New email:
PHP Version: OS:


 [2019-08-06 12:42 UTC] andrey dot sperkach at gmail dot com
touch() with time-params does not set file modification date

PHP 7.0.x not affected by this problem

PHP 7.3.8 set it to 1970.01.01 - wrong

touch($file) without time-param set modification time to current datetime!

Test script:
$file = 'test.txt';
$current = file_get_contents($file);
$current = "TEST";
file_put_contents($file, $current);

Expected result:
modification time = current + 1 day

Actual result:
modification time = 1970.01.01 3:01:14


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-06 13:25 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2019-08-06 13:25 UTC]
I'm not able to reproduce the described behavior.  Are you working
on a local file system?
 [2019-08-06 13:37 UTC] ron at ronsteiner dot info
This is also happening to me with 7.2.21 on Windows Server 2012 and 2016.  Works fine with 7.2.20.
 [2019-08-06 13:46 UTC]
This might be related to the fix for bug #78241.  Are you using official PHP builds from  If so, which ones exactly?
 [2019-08-06 14:06 UTC]
-Operating System: Windows 10 +Operating System: Windows x86
 [2019-08-06 14:06 UTC]
Ah, can reproduce with x86 builds.
 [2019-08-06 14:11 UTC] ron at ronsteiner dot info
Yes, x86 build.
 [2019-08-06 15:12 UTC]
-Status: Feedback +Status: Verified
 [2019-08-06 15:12 UTC]
Thanks for the confirmation, and for reporting this in the first
place!  Indeed it is a regression caused by fixing the mentioned
 [2019-08-06 15:31 UTC]
-Status: Verified +Status: Duplicate
 [2019-08-06 15:31 UTC]
This is actually a duplicate of bug #78282, which had been
fixed, but not properly applied to PHP-7.2 and 7.3.  Oops!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 25 13:03:35 2021 UTC