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