pajoye          Mon Aug 11 13:11:31 2008 UTC

  Removed files:               (Branch: PHP_5_3)
    /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] MFH: 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.409.2.6.2.28.2.19&r2=1.409.2.6.2.28.2.20&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.19 
php-src/ext/standard/file.c:1.409.2.6.2.28.2.20
--- php-src/ext/standard/file.c:1.409.2.6.2.28.2.19     Wed Jul 23 11:25:14 2008
+++ php-src/ext/standard/file.c Mon Aug 11 13:11:30 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: file.c,v 1.409.2.6.2.28.2.19 2008/07/23 11:25:14 tony2001 Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.28.2.20 2008/08/11 13:11:30 pajoye Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -1731,8 +1731,20 @@
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first 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;
+       
+       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 (!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.1.2.2.2.4&r2=1.1.2.2.2.5&diff_format=u
Index: php-src/ext/standard/tests/file/copy_variation4.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to