xref: /PHP-8.3/ext/libxml/tests/bug51903.phpt (revision 74859783)
1--TEST--
2Bug #51903 (simplexml_load_file() doesn't use HTTP headers)
3--EXTENSIONS--
4simplexml
5--SKIPIF--
6<?php
7if (@!include "./ext/standard/tests/http/server.inc") die('skip server.inc not available');
8http_server_skipif();
9?>
10--FILE--
11<?php
12require "./ext/standard/tests/http/server.inc";
13$responses = [
14    "data://text/plain,HTTP/1.1 200 OK\r\n"
15    . "Content-Type: text/xml; charset=ISO-8859-1\r\n\r\n"
16    . "<?xml version=\"1.0\"?>\n"
17    . "<root>\xE4\xF6\xFC</root>\n",
18    "data://text/plain,HTTP/1.1 200 OK\r\n"
19    . "Content-Type: text/xml; charset=ISO-8859-1; foo=bar\r\n\r\n"
20    . "<?xml version=\"1.0\"?>\n"
21    . "<root>\xE4\xF6\xFC</root>\n",
22    "data://text/plain,HTTP/1.1 200 OK\r\n"
23    . "Content-Type: text/xml; charset=\"ISO-8859-1\" ; foo=bar\r\n\r\n"
24    . "<?xml version=\"1.0\"?>\n"
25    . "<root>\xE4\xF6\xFC</root>\n",
26];
27['pid' => $pid, 'uri' => $uri] = http_server($responses);
28
29for ($i = 0; $i < count($responses); $i++) {
30    $sxe = simplexml_load_file($uri);
31    echo "$sxe\n";
32}
33
34http_server_kill($pid);
35?>
36--EXPECT--
37äöü
38äöü
39äöü
40