From: Jani Taskinen Date: Sat, 1 Aug 2009 03:17:31 +0000 (+0000) Subject: - Fixed bug #43510 (stream_get_meta_data() does not return same mode as used in fopen) X-Git-Tag: php-5.2.11RC1~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df61b3c6ebad5b9b00ef40bb5c32de02de70d35e;p=php - Fixed bug #43510 (stream_get_meta_data() does not return same mode as used in fopen) --- diff --git a/NEWS b/NEWS index 877c868048..d5c0869dab 100644 --- a/NEWS +++ b/NEWS @@ -75,6 +75,8 @@ PHP NEWS - Fixed bug #45141 (setcookie will output expires years of >4 digits). (Ilia) - Fixed bug #44144 (spl_autoload_functions() should return object instance when appropriate). (Hannes, Etienne) +- Fixed bug #43510 (stream_get_meta_data() does not return same mode as used + in fopen). (Jani) - Fixed bug #42434 (ImageLine w/ antialias = 1px shorter). (wojjie at gmail dot com, Kalle) diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 64981682b0..6a39982d3f 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -325,7 +325,6 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, strlcat(scratch, " HTTP/1.0\r\n", scratch_len); } - /* send it */ php_stream_write(stream, scratch, strlen(scratch)); @@ -756,6 +755,8 @@ out: * the stream */ stream->position = 0; + /* restore mode */ + strlcpy(stream->mode, mode, sizeof(stream->mode)); } return stream; diff --git a/ext/standard/tests/http/bug43510.phpt b/ext/standard/tests/http/bug43510.phpt new file mode 100644 index 0000000000..710b086351 --- /dev/null +++ b/ext/standard/tests/http/bug43510.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #43510: stream_get_meta_data() does not return same mode as used in fopen +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(1) "r" +string(2) "rb"