summaryrefslogtreecommitdiff
path: root/ext/libxml/tests/bug51903.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/libxml/tests/bug51903.phpt')
-rw-r--r--ext/libxml/tests/bug51903.phpt38
1 files changed, 38 insertions, 0 deletions
diff --git a/ext/libxml/tests/bug51903.phpt b/ext/libxml/tests/bug51903.phpt
new file mode 100644
index 0000000000..ebbca2068c
--- /dev/null
+++ b/ext/libxml/tests/bug51903.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Bug #51903 (simplexml_load_file() doesn't use HTTP headers)
+--SKIPIF--
+<?php
+if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
+if (@!include "./ext/standard/tests/http/server.inc") die('skip server.inc not available');
+http_server_skipif();
+?>
+--FILE--
+<?php
+require "./ext/standard/tests/http/server.inc";
+$responses = [
+ "data://text/plain,HTTP/1.1 200 OK\r\n"
+ . "Content-Type: text/xml; charset=ISO-8859-1\r\n\r\n"
+ . "<?xml version=\"1.0\"?>\n"
+ . "<root>\xE4\xF6\xFC</root>\n",
+ "data://text/plain,HTTP/1.1 200 OK\r\n"
+ . "Content-Type: text/xml; charset=ISO-8859-1; foo=bar\r\n\r\n"
+ . "<?xml version=\"1.0\"?>\n"
+ . "<root>\xE4\xF6\xFC</root>\n",
+ "data://text/plain,HTTP/1.1 200 OK\r\n"
+ . "Content-Type: text/xml; charset=\"ISO-8859-1\" ; foo=bar\r\n\r\n"
+ . "<?xml version=\"1.0\"?>\n"
+ . "<root>\xE4\xF6\xFC</root>\n",
+];
+['pid' => $pid, 'uri' => $uri] = http_server($responses);
+
+for ($i = 0; $i < count($responses); $i++) {
+ $sxe = simplexml_load_file($uri);
+ echo "$sxe\n";
+}
+
+http_server_kill($pid);
+?>
+--EXPECT--
+äöü
+äöü
+äöü