diff options
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | ext/standard/file.c | 4 |
2 files changed, 6 insertions, 0 deletions
@@ -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; } |
