]> granicus.if.org Git - php/commitdiff
Fixed copy test as well as the directory check inside copy() function
authorIlia Alshanetsky <iliaa@php.net>
Sun, 12 Aug 2007 17:09:59 +0000 (17:09 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 12 Aug 2007 17:09:59 +0000 (17:09 +0000)
ext/standard/file.c
ext/standard/tests/file/copy_variation12.phpt

index 594a5ec3f88ec1c5b9d69622d07759f88e27e3f6..d0ae78fb54041234495780c750bf3b2575fba6e6 100644 (file)
@@ -1765,13 +1765,13 @@ PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC)
                default: /* failed to stat file, does not exist? */
                        return ret;
        }
-       if (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET, &dest_s, NULL) != 0) {
-               goto safe_to_copy;
-       }
        if (S_ISDIR(src_s.sb.st_mode)) {
                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;
+       }
        if (!src_s.sb.st_ino || !dest_s.sb.st_ino) {
                goto no_stat;
        }
index 32a45311a2405276b4d7ae72240368c22e6f9d2a..e5a415e9d7bc50cf2dff26989bf3d47628866e15 100644 (file)
@@ -41,8 +41,12 @@ rmdir(dirname(__FILE__)."/copy_variation12");
 
 --EXPECTF--
 *** Test copy() function: Trying to create a copy of an existing dir ***
+
+Warning: copy(): The first argument to copy() function cannot be a directory in %s/copy_variation12.php on line %d
 bool(false)
 bool(false)
 int(4096)
-int(0)
+
+Warning: filesize(): stat failed for %s/copy_copy_variation12 in %s/copy_variation12.php on line %d
+bool(false)
 *** Done ***