xref: /PHP-8.4/ext/standard/tests/http/bug43510.phpt (revision 95f25837)
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(); ?>
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' => $pid, 'uri' => $uri ] = http_server($responses, $output);
17
18foreach(array('r', 'rb') as $mode) {
19    $fd = fopen($uri, $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