From 98ff9c3b600d0a98a8febe836acdfe4f67e91f53 Mon Sep 17 00:00:00 2001 From: gggeek Date: Sun, 12 Apr 2015 00:09:16 +0100 Subject: [PATCH] Add test for latest fixes and update NEWS --- NEWS | 8 +++++++- tests/1ParsingBugsTest.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ee0d49a..d54c51f 100644 --- a/NEWS +++ b/NEWS @@ -38,7 +38,13 @@ PLEASE READ CAREFULLY THE NOTES BELOW to insure a smooth upgrade. * improved: the testsuite has basic checks for the debugger and demo files -* fixed: the debugger would fail sending a request with ISO-8859-1 payload +* fixed: the debugger would fail sending a request with ISO-8859-1 payload (it missed the character set declaration) + +* fixed: the server would fail to decode a request with ISO-8859-1 payload and character set declaration in the xml prologue only + +* fixed: the client would fail to decode a response with ISO-8859-1 payload and character set declaration in the xml prologue only + +* fixed: the function decode_xml() would not decode an xml with character set declaration in the xml prologue XML-RPC for PHP version 3.0.0 - 2014/6/15 diff --git a/tests/1ParsingBugsTest.php b/tests/1ParsingBugsTest.php index 949130f..33915ca 100644 --- a/tests/1ParsingBugsTest.php +++ b/tests/1ParsingBugsTest.php @@ -421,6 +421,7 @@ and there they were.postid7414222value(); $v = $v['content']; $this->assertEquals("������", $v); + $f = 'userid311127 dateCreated20011126T09:17:52content' . utf8_encode('������') . 'postid7414222 '; @@ -428,6 +429,36 @@ and there they were.postid7414222value(); $v = $v['content']; $this->assertEquals("������", $v); + + $r = php_xmlrpc_decode_xml($f); + $v = $r->value(); + $v = $v->structmem('content')->scalarval(); + $this->assertEquals("������", $v); + } + + public function testLatin1Response() + { + $s = new xmlrpcmsg('dummy'); + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . 'userid311127 +dateCreated20011126T09:17:52content' . '������' . 'postid7414222 +'; + $r = $s->parseResponse($f, false, 'phpvals'); + $v = $r->value(); + $v = $v['content']; + $this->assertEquals("������", $v); + + $f = 'userid311127 +dateCreated20011126T09:17:52content' . '������' . 'postid7414222 +'; + $r = $s->parseResponse($f, false, 'phpvals'); + $v = $r->value(); + $v = $v['content']; + $this->assertEquals("������", $v); + + $r = php_xmlrpc_decode_xml($f); + $v = $r->value(); + $v = $v->structmem('content')->scalarval(); + $this->assertEquals("������", $v); } public function testUTF8IntString() -- 2.43.0