php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
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

BUT:
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);
touch($file,time()+86400);

Expected result:
----------------
modification time = current + 1 day

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-06 13:25 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2019-08-06 13:25 UTC] cmb@php.net
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] cmb@php.net
This might be related to the fix for bug #78241.  Are you using official PHP builds from windows.php.net?  If so, which ones exactly?
 [2019-08-06 14:06 UTC] cmb@php.net
-Operating System: Windows 10 +Operating System: Windows x86
 [2019-08-06 14:06 UTC] cmb@php.net
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] cmb@php.net
-Status: Feedback +Status: Verified
 [2019-08-06 15:12 UTC] cmb@php.net
Thanks for the confirmation, and for reporting this in the first
place!  Indeed it is a regression caused by fixing the mentioned
bug.
 [2019-08-06 15:31 UTC] cmb@php.net
-Status: Verified +Status: Duplicate
 [2019-08-06 15:31 UTC] cmb@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 21:01:28 2024 UTC