From: RQuadling at GMail dot com Operating system: Windows XP SP3 PHP version: 5.3SVN-2009-07-24 (snap) PHP Bug Type: Filesystem function related Bug description: The function touch() fails on directories.
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 -- Edit bug report at http://bugs.php.net/?id=49047&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49047&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49047&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49047&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49047&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49047&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49047&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49047&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49047&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49047&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49047&r=support Expected behavior: http://bugs.php.net/fix.php?id=49047&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49047&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49047&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49047&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49047&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49047&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49047&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49047&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49047&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49047&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49047&r=mysqlcfg