xref: /PHP-7.3/ext/standard/tests/http/bug43510.phpt (revision a56c0bd0)
1--TEST--
2Bug #43510 (stream_get_meta_data() does not return same mode as used in fopen)
3--INI--
4allow_url_fopen=1
5--SKIPIF--
6<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
7--FILE--
8<?php
9require 'server.inc';
10
11$responses = array(
12	"data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
13	"data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
14);
15
16$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
17
18foreach(array('r', 'rb') as $mode) {
19	$fd = fopen('http://127.0.0.1:12342/', $mode, false);
20	$meta = stream_get_meta_data($fd);
21	var_dump($meta['mode']);
22	fclose($fd);
23}
24
25http_server_kill($pid);
26
27?>
28--EXPECT--
29string(1) "r"
30string(2) "rb"
31