|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 06:00:01 2025 UTC |
Description: ------------ SolrUtils::digestXmlResponse() fails to parse this response: <?xml version="1.0" encoding="UTF-8"?> <response> <result name="response" numFound="7" start="0" maxScore="1.0"> <doc><str name="foo">bar</str></doc> </result> </response> It will work for this response with a slight whitespace change: <?xml version="1.0" encoding="UTF-8"?> <response> <result name="response" numFound="7" start="0" maxScore="1.0"> <doc> <str name="foo">bar</str></doc> </result> </response> This is the diff between the two responses: $ diff -u fail.xml success.xml --- fail.xml 2018-06-01 19:55:28.375146179 +0200 +++ success.xml 2018-06-01 19:55:57.128476904 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <response> <result name="response" numFound="7" start="0" maxScore="1.0"> - <doc><str name="foo">bar</str></doc> + <doc> <str name="foo">bar</str></doc> </result> </response> $ php repro.php Notice: SolrUtils::digestXmlResponse(): Unexpected end of serialized data in /code/in/test.php on line 2 Warning: SolrUtils::digestXmlResponse(): Error unserializing raw response. in /code/in/test.php on line 2 Fatal error: Uncaught SolrException: Error un-serializing response in /code/in/test.php:2 Stack trace: #0 /code/in/test.php(2): SolrUtils::digestXmlResponse('<?xml version="...') #1 {main} thrown in /code/in/test.php on line 2 Test script: --------------- <?php $xml = '<?xml version="1.0" encoding="UTF-8"?> <response> <result name="response" numFound="7" start="0" maxScore="1.0"> <doc><str name="foo">bar</str></doc> </result> </response>'; SolrUtils::digestXmlResponse($xml);