ID: 49047
Updated by: [email protected]
Reported By: RQuadling at GMail dot com
-Status: Open
+Status: Assigned
Bug Type: Filesystem function related
Operating System: win32 only - Windows XP SP3
PHP Version: 5.3SVN-2009-07-24 (snap)
-Assigned To:
+Assigned To: pajoye
New Comment:
commit on its way
Previous Comments:
------------------------------------------------------------------------
[2009-07-24 12:48:49] RQuadling at GMail dot com
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 this bug report at http://bugs.php.net/?id=49047&edit=1