svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h branches/PHP_5_3/TSRM/tsrm_win32.c
branches/PHP_5_3/TSRM/tsrm_win32.h branches/PHP_5_3/ext/standard/tests/file/bug49047.phpt trunk/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.h
trunk/TSRM/tsrm_win32.c trunk/TSRM/tsrm_win32.h trunk/ext/standard/tests/file/bug49047.phpt
| From: | Pierre-Alain Joye | Date: | Tue, 25 Aug 2009 09:16:53 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h branches/PHP_5_3/TSRM/tsrm_win32.c branches/PHP_5_3/TSRM/tsrm_win32.h branches/PHP_5_3/ext/standard/tests/file/bug49047.phpt trunk/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.h trunk/TSRM/tsrm_win32.c trunk/TSRM/tsrm_win32.h trunk/ext/standard/tests/file/bug49047.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-60215@lists.php.net to get a copy of this message | ||
pajoye Tue, 25 Aug 2009 09:16:53 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=287673
Log:
- fix #49047, touch may fail on directory
Bug: http://bugs.php.net/49047 (Assigned) The function
touch() fails on directories.
Changed paths:
U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h
U php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c
U php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.h
A php/php-src/branches/PHP_5_3/ext/standard/tests/file/bug49047.phpt
U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c
U php/php-src/trunk/TSRM/tsrm_virtual_cwd.h
U php/php-src/trunk/TSRM/tsrm_win32.c
U php/php-src/trunk/TSRM/tsrm_win32.h
A php/php-src/trunk/ext/standard/tests/file/bug49047.phpt
Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c 2009-08-25 09:15:47 UTC (rev 287672)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c 2009-08-25 09:16:53 UTC (rev 287673)
@@ -1193,7 +1193,7 @@
}
/* }}} */
-static int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
+TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
{
FILETIME mtime, atime;
HANDLE hFile;
Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h 2009-08-25 09:15:47 UTC (rev 287672)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.h 2009-08-25 09:16:53 UTC (rev 287673)
@@ -311,8 +311,13 @@
#define VCWD_REALPATH(path, real_path) tsrm_realpath(path, real_path TSRMLS_CC)
#if HAVE_UTIME
-#define VCWD_UTIME(path, time) utime(path, time)
+# ifdef TSRM_WIN32
+# define VCWD_UTIME(path, time) win32_utime(path, time)
+# else
+# define VCWD_UTIME(path, time) utime(path, time)
+# endif
#endif
+
#define VCWD_CHMOD(path, mode) chmod(path, mode)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c 2009-08-25 09:15:47 UTC (rev 287672)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c 2009-08-25 09:16:53 UTC (rev 287673)
@@ -170,7 +170,7 @@
fAccess = bucket->is_readable;
goto Finished;
}
- desired_access = FILE_GENERIC_READ;
+ desired_access = FILE_GENERIC_READ|FILE_FLAG_BACKUP_SEMANTICS;
} else { // if(mode <= 6)
if(bucket != NULL && bucket->is_rvalid && bucket->is_wvalid) {
fAccess = bucket->is_readable & bucket->is_writable;
Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.h
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.h 2009-08-25 09:15:47 UTC (rev 287672)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.h 2009-08-25 09:16:53 UTC (rev 287673)
@@ -97,6 +97,7 @@
TSRM_API FILE *popen(const char *command, const char *type);
TSRM_API int pclose(FILE *stream);
TSRM_API int tsrm_win32_access(const char *pathname, int mode);
+TSRM_API int win32_utime(const char *filename, struct utimbuf *buf);
TSRM_API int shmget(int key, int size, int flags);
TSRM_API void *shmat(int key, const void *shmaddr, int flags);
Added: php/php-src/branches/PHP_5_3/ext/standard/tests/file/bug49047.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/file/bug49047.phpt (rev
0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/bug49047.phpt 2009-08-25 09:16:53 UTC (rev
287673)
@@ -0,0 +1,17 @@
+--TEST--
+Test fopen() function : variation: interesting paths, no use include path
+--FILE--
+<?php
+// fopen with interesting windows paths.
+$testdir = __DIR__ . '/bug47177.tmpdir';
+mkdir($testdir);
+$t = time() - 3600;
+touch($testdir, $t);
+clearstatcache();
+$t2 = filemtime($testdir);
+if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
+rmdir($testdir);
+echo "Ok.";
+?>
+--EXPECTF--
+Ok.
Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c
===================================================================
--- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-25 09:15:47 UTC (rev 287672)
+++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-25 09:16:53 UTC (rev 287673)
@@ -1192,7 +1192,7 @@
}
/* }}} */
-static int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
+TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
{
FILETIME mtime, atime;
HANDLE hFile;
Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.h
===================================================================
--- php/php-src/trunk/TSRM/tsrm_virtual_cwd.h 2009-08-25 09:15:47 UTC (rev 287672)
+++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.h 2009-08-25 09:16:53 UTC (rev 287673)
@@ -328,8 +328,13 @@
#define VCWD_REALPATH(path, real_path) tsrm_realpath(path, real_path TSRMLS_CC)
#if HAVE_UTIME
-#define VCWD_UTIME(path, time) utime(path, time)
+# ifdef TSRM_WIN32
+# define VCWD_UTIME(path, time) win32_utime(path, time)
+# else
+# define VCWD_UTIME(path, time) utime(path, time)
+# endif
#endif
+
#define VCWD_CHMOD(path, mode) chmod(path, mode)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
Modified: php/php-src/trunk/TSRM/tsrm_win32.c
===================================================================
--- php/php-src/trunk/TSRM/tsrm_win32.c 2009-08-25 09:15:47 UTC (rev 287672)
+++ php/php-src/trunk/TSRM/tsrm_win32.c 2009-08-25 09:16:53 UTC (rev 287673)
@@ -171,7 +171,7 @@
fAccess = bucket->is_readable;
goto Finished;
}
- desired_access = FILE_GENERIC_READ;
+ desired_access = FILE_GENERIC_READ|FILE_FLAG_BACKUP_SEMANTICS;
} else { // if(mode <= 6)
if(bucket != NULL && bucket->is_rvalid && bucket->is_wvalid) {
fAccess = bucket->is_readable & bucket->is_writable;
Modified: php/php-src/trunk/TSRM/tsrm_win32.h
===================================================================
--- php/php-src/trunk/TSRM/tsrm_win32.h 2009-08-25 09:15:47 UTC (rev 287672)
+++ php/php-src/trunk/TSRM/tsrm_win32.h 2009-08-25 09:16:53 UTC (rev 287673)
@@ -97,6 +97,7 @@
TSRM_API FILE *popen(const char *command, const char *type);
TSRM_API int pclose(FILE *stream);
TSRM_API int tsrm_win32_access(const char *pathname, int mode);
+TSRM_API int win32_utime(const char *filename, struct utimbuf *buf);
TSRM_API int shmget(int key, int size, int flags);
TSRM_API void *shmat(int key, const void *shmaddr, int flags);
Added: php/php-src/trunk/ext/standard/tests/file/bug49047.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/file/bug49047.phpt (rev 0)
+++ php/php-src/trunk/ext/standard/tests/file/bug49047.phpt 2009-08-25 09:16:53 UTC (rev 287673)
@@ -0,0 +1,17 @@
+--TEST--
+Test fopen() function : variation: interesting paths, no use include path
+--FILE--
+<?php
+// fopen with interesting windows paths.
+$testdir = __DIR__ . '/bug47177.tmpdir';
+mkdir($testdir);
+$t = time() - 3600;
+touch($testdir, $t);
+clearstatcache();
+$t2 = filemtime($testdir);
+if ($t2 != $t) echo "failed (got $t2, expecting $t)\n";
+rmdir($testdir);
+echo "Ok.";
+?>
+--EXPECTF--
+Ok.