From: Ilia Alshanetsky Date: Fri, 10 Aug 2007 00:36:57 +0000 (+0000) Subject: Fixed bug #42243 (copy() does not ouput an error when the first arg is a X-Git-Tag: php-5.2.4RC2~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e9b8f373412a0017e74b7a4766b3ed78219afd25;p=php Fixed bug #42243 (copy() does not ouput an error when the first arg is a dir). --- diff --git a/NEWS b/NEWS index 902fc83ee7..482e93f53c 100644 --- 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) diff --git a/ext/standard/file.c b/ext/standard/file.c index 30ca3977dd..ab7ac00e50 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -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; }