From: Stanislav Malyshev Date: Mon, 1 Dec 2014 01:07:02 +0000 (-0800) Subject: Merge branch 'PHP-5.5' into PHP-5.6 X-Git-Tag: PRE_NATIVE_TLS_MERGE~108^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60d5b2ec24625e399b862eb1dff92c32d54386c7;p=php Merge branch 'PHP-5.5' into PHP-5.6 * PHP-5.5: Added test and review suggestion Fix bug #68335: rmdir doesnt work with file:// stream wrapper --- 60d5b2ec24625e399b862eb1dff92c32d54386c7 diff --cc main/streams/plain_wrapper.c index 69c6a3ce26,aae2f6da36..6d8b5c203d --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@@ -1023,14 -1029,10 +1023,10 @@@ static php_stream *php_plain_files_stre return php_stream_fopen_rel(path, mode, opened_path, options); } -static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +static int php_plain_files_url_stater(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { - char *p; - - if ((p = strstr(url, "://")) != NULL) { - if (p < strchr(url, '/')) { - url = p + 3; - } + if (strncasecmp(url, "file://", sizeof("file://") - 1) == 0) { + url += sizeof("file://") - 1; } if (php_check_open_basedir_ex(url, (flags & PHP_STREAM_URL_STAT_QUIET) ? 0 : 1 TSRMLS_CC)) { @@@ -1053,15 -1055,12 +1049,12 @@@ return VCWD_STAT(url, &ssb->sb); } -static int php_plain_files_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) { - char *p; int ret; - if ((p = strstr(url, "://")) != NULL) { - if (p < strchr(url, '/')) { - url = p + 3; - } + if (strncasecmp(url, "file://", sizeof("file://") - 1) == 0) { + url += sizeof("file://") - 1; } if (php_check_open_basedir(url TSRMLS_CC)) { @@@ -1082,9 -1081,8 +1075,8 @@@ return 1; } -static int php_plain_files_rename(php_stream_wrapper *wrapper, char *url_from, char *url_to, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) { - char *p; int ret; if (!url_from || !url_to) { @@@ -1259,8 -1251,12 +1245,12 @@@ static int php_plain_files_mkdir(php_st } } -static int php_plain_files_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_plain_files_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) { + if (strncasecmp(url, "file://", sizeof("file://") - 1) == 0) { + url += sizeof("file://") - 1; + } + #if PHP_WIN32 int url_len = strlen(url); #endif @@@ -1286,10 -1282,9 +1276,9 @@@ return 1; } -static int php_plain_files_metadata(php_stream_wrapper *wrapper, char *url, int option, void *value, php_stream_context *context TSRMLS_DC) +static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url, int option, void *value, php_stream_context *context TSRMLS_DC) { struct utimbuf *newtime; - char *p; #if !defined(WINDOWS) && !defined(NETWARE) uid_t uid; gid_t gid;