]> granicus.if.org Git - php/commitdiff
Fixed bug #42243 (copy() does not ouput an error when the first arg is a
authorIlia Alshanetsky <iliaa@php.net>
Fri, 10 Aug 2007 00:36:57 +0000 (00:36 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 10 Aug 2007 00:36:57 +0000 (00:36 +0000)
dir).

NEWS
ext/standard/file.c

diff --git a/NEWS b/NEWS
index 902fc83ee771fe8e10c2f4f0b8b2983958357d2a..482e93f53c15de5aa719c180a3dbbd9a06b80682 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ PHP                                                                        NEWS
 - Fixed bug #42261 (header wrong for date field). (roberto at spadim dot com
   dot br, Ilia)
 - Fixed bug #42247 (ldap_parse_result() not defined under win32). (Jani)
+- Fixed bug #42243 (copy() does not ouput an error when the first arg is a
+  dir). (Ilia)
 - Fixed bug #42237 (stream_copy_to_stream returns invalid values for mmaped 
   streams). (andrew dot minerd at sellingsource dot com, Ilia)
 - Fixed bug #42233 (Problems with æøå in extract()). (Jani)
index 30ca3977dd4c733512c556fdc9ac47ac171246f5..ab7ac00e5017755b263e357d775e750fb355d133 100644 (file)
@@ -1765,6 +1765,10 @@ PHPAPI int php_copy_file_ex(char *src, char *dest, int src_chk TSRMLS_DC)
        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 (!src_s.sb.st_ino || !dest_s.sb.st_ino) {
                goto no_stat;
        }