pajoye Mon Aug 11 13:09:01 2008 UTC
Removed files:
/php-src/ext/standard/tests/file copy_variation4-win32.phpt
Modified files:
/php-src/ext/standard file.c
/php-src/ext/standard/tests/file copy_variation4.phpt
Log:
- [DOC] detect if dest is a dir (if the given stream layer supports stat)
and fails
. remove win32 specific test. The errors are not the same
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.522&r2=1.523&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.522 php-src/ext/standard/file.c:1.523
--- php-src/ext/standard/file.c:1.522 Wed Jul 23 11:24:34 2008
+++ php-src/ext/standard/file.c Mon Aug 11 13:09:01 2008
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.522 2008/07/23 11:24:34 tony2001 Exp $ */
+/* $Id: file.c,v 1.523 2008/08/11 13:09:01 pajoye Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -1892,9 +1892,26 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument
to copy() function cannot be a directory");
return FAILURE;
}
+
+ switch (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET,
&dest_s, NULL)) {
+ case -1:
+ /* non-statable stream */
+ goto safe_to_copy;
+ break;
+ case 0:
+ break;
+ default: /* failed to stat file, does not exist? */
+ return ret;
+ }
+ if (S_ISDIR(dest_s.sb.st_mode)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The second
argument to copy() function cannot be a directory");
+ return FAILURE;
+ }
+ /*
if (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET, &dest_s,
NULL) != 0) {
goto safe_to_copy;
}
+*/
if (!src_s.sb.st_ino || !dest_s.sb.st_ino) {
goto no_stat;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/copy_variation4.phpt?r1=1.5&r2=1.6&diff_format=u
Index: php-src/ext/standard/tests/file/copy_variation4.phpt