|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-08-24 16:33 UTC] pajoye@php.net
[2009-08-25 09:16 UTC] svn@php.net
[2009-08-25 09:17 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
Description: ------------ Trying to touch() a win32 folder fails. In tracking this back through the source, I think the issue is that PHP is calling the external utime() function. For my build (I'm a novice so please bear with me), I see that ... HAVE_UTIME TSRM_WIN32 are both set, but VIRTUAL_DIR is not. This is a repeat of bug#35980, but as that bug is closed and the example code below doesn't work, I assume this is a new bug. So, in TSRM/tsrm_virtual_cwd.h, the call that is being made is ... #ifdef VIRTUAL_DIR ... #if HAVE_UTIME #define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC) #endif ... #else ... #if HAVE_UTIME #define VCWD_UTIME(path, time) utime(path, time) #endif ... #endif utime(path, time) I think this is the external call and as such will fail. I think that is why the virtual version exists (which in turn calls win32_utime) Reproduce code: --------------- <?php $s_Directory = 'C:\\Test'; $dt_DOB = strtotime('2008-10-19 18:43'); if (file_exists($s_Directory) && !rmdir($s_Directory)) { die("Failed to delete $s_Directory"); } echo "Create $s_Directory", PHP_EOL; if (!mkdir($s_Directory)) { die("Failed to create $s_Directory"); } else { echo "Created $s_Directory", PHP_EOL; } echo "Touch $s_Directory : ", date('r', $dt_DOB), PHP_EOL; if (!touch($s_Directory, $dt_DOB)) { die("Failed to touch $s_Directory"); } else { echo "Touched $s_Directory", PHP_EOL; } Expected result: ---------------- Create C:\Test Created C:\Test Touch C:\Test : Sun, 19 Oct 2008 18:43:00 +0100 Touched C:\Test Actual result: -------------- Create C:\Test Created C:\Test Touch C:\Test : Sun, 19 Oct 2008 18:43:00 +0100 Warning: touch(): Utime failed: Permission denied in Z:\touchdir.php on line 22 Failed to touch C:\Test