com php-src: Merge branch 'PHP-5.5' into PHP-5.6: main/streams/ plain_wrapper.c
| From: | Stanislav Malyshev | Date: | Mon, 01 Dec 2014 01:07:02 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.5' into PHP-5.6: main/streams/ plain_wrapper.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83399@lists.php.net to get a copy of this message | ||
Commit: 60d5b2ec24625e399b862eb1dff92c32d54386c7
Author: Stanislav Malyshev <stas@php.net> Sun, 30 Nov 2014 17:07:02 -0800
Parents: f6aa6324fbfe981847926d3e048f83bd4b468704 04808aa7e18ad0b2f6d014d06777b519e41dbccf
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=60d5b2ec24625e399b862eb1dff92c32d54386c7
Log:
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
Bugs:
https://bugs.php.net/68335
Changed paths:
MM main/streams/plain_wrapper.c
Diff:
diff --cc main/streams/plain_wrapper.c
index 69c6a3c,aae2f6d..6d8b5c2
--- 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;