PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Web Services » XML_RPC » Bug #1874

server breaks down when included file terminates with whitespace

Details

Submitted2004-07-14 15:52 UTC
Fromignatius dot reilly at free dot fr
Assigneddanielc
StatusBogus
PackageXML_RPC
PHP Version4.3.7
OSWindows 2000
Roadmaps(Not assigned)

Comments

[2004-07-14 15:52 UTC] ignatius dot reilly at free dot fr

Description:
------------
A XML-RPC server file includes the service function from another file

When the included file terminates with whitespaces after the final "?>", the service client interprets the response inconsistently and breaks down the service

Reproduce code:
---------------
Download test case:
http://www.auderghem-analytica.com/download/XML-RPC_bug.zip

Please toy with the whitespace at the end of ws.test.php and inspect the client's response object

Expected result:
----------------
-->
<methodResponse>
<params>
<param>
<value><string>Now it works</string></value>
</param>
</params>
</methodResponse>
---END---

---EVALING---[43 chars]---
new XML_RPC_Value("Now it works", 'string');
---END---

Actual result:
--------------
-->
<methodResponse>
<params>
<param>
<value><string>Now it works</string></value>
</param>
</params>
</methodResponse>
---END---

Fault: Code: 2 Reason 'Invalid return payload: enabling debugging to examine incoming payload'

Clearly inconsistent!

[2004-11-30 22:36 UTC] techtonik at tut dot by

Server component use header() function to provide some required headers by both HTTP and XML-RPC protocols. Headers must be sent before any output to client. While including files with whitespaces after ?> you make whitespaces appear before headers.

http://www.php.net/manual/en/function.header.php
"Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file."

[2004-12-01 07:06 UTC] ignatius dot reilly at free dot fr

this is quite clear.
what puzzles me, though, is the inconsistency of the response, which makes debugging difficult.
A fault response would be more appropriate in this case.