php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61380 XMLRPC Return Data Failure
Submitted: 2012-03-14 00:36 UTC Modified: 2012-03-14 02:31 UTC
From: thephpguru at hotmail dot com Assigned:
Status: Not a bug Package: XML related
PHP Version: 5.3.10 OS: Fedora 13
Private report: No CVE-ID: None
 [2012-03-14 00:36 UTC] thephpguru at hotmail dot com
Description:
------------
Hello I am writing because I have a script that uses the XMLRPC functions. I have used the same scripts for about 3 years now with no problems. One example of the script in question can be found at:
 

http://freshsoftware.dyndns.info/scripts_for_sale/usps/usps_xml_carrier_pickup_live.phps

 
The application that runs this script can be found at:

http://freshsoftware.dyndns.info/scripts_for_sale/usps/carrier_pickup_1.php?item_num=USPS-1565986&t=computer_software&software_title=php_usps_xml_carrier_pickup

The problem with this script is that the delivery confirmation number BLAH collected from the function "CharacterDataHandler" and other $data is not being returned by the XML PARSE function or the data is broken up into different parts. For example read the confirmation number in the first set of lines then read the comfirmation number in the second set of lines. 

There are several other scripts on that site that also use the same XMLRPC functions and are failing in one way or another. I have used these scripts for about 3 years with out making changes. I had no problems with PHP-5.2.3 and earlier versions.

I tried to install PHP-5.4.0 and the MAKE process failed. I then install PHP-5.3.10 but the XMLRPC functions all fail.

A copy of the server Make Test is:

http://freshsoftware.dyndns.info/scripts_for_sale/usps/make_test.txt

Notice that there are 2 XML related bugs at the end of the report. I removed --enable-debug from my CONFIG but that does not solve the problem. Please help. My current config can be found at:

http://freshsoftware.dyndns.info/php/


Please read the attached MAKE TEST file.



Eric Williams
  

Expected result:
----------------
Unbroken data.

Actual result:
--------------
Data that is broken into different parts.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-14 01:12 UTC] thephpguru at hotmail dot com
My php.ini file can be found at:

http://freshsoftware.dyndns.info/scripts_for_sale/usps/php.ini
 [2012-03-14 01:23 UTC] aharvey@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2012-03-14 01:23 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2012-03-14 01:44 UTC] thephpguru at hotmail dot com
A sample code is:

http://freshsoftware.dyndns.info/usps/usps_xml_carrier_pickup_live.phps
 [2012-03-14 01:44 UTC] thephpguru at hotmail dot com
-Status: Feedback +Status: Open
 [2012-03-14 01:47 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2012-03-14 01:47 UTC] aharvey@php.net
I saw that. A (much) shorter, standalone reproduction script is required.
 [2012-03-14 01:57 UTC] thephpguru at hotmail dot com
-Status: Feedback +Status: Open
 [2012-03-14 01:57 UTC] thephpguru at hotmail dot com
I can not make a complex script any shorter. In short the open_url function on line 100 connects to the USPS server. The startElement function on line 117 sets the array, and names the XML tree ID structure, The endElement function set the end of the tree info, and the CharacterDataHandler function captures the data between start and end functions. The xml_set_character_data_handler function is then used to read the data.

But the data is getting turncated.
 [2012-03-14 02:00 UTC] thephpguru at hotmail dot com
My problem is very similar to bug 46699. And that is what the MAKE_TEST file shows.

https://freshsoftware.dyndns.info/~freshsoftware/scripts_for_sale/usps/make_test.txt
 [2012-03-14 02:19 UTC] aharvey@php.net
I don't really see how bug #46699 is related, besides being another xml_parse() 
bug -- it was a crasher related to namespace-aware parsers, and your issue 
involves neither crashing nor namespaces.

The more I look at this, the less it looks like a bug in PHP. This script behaves 
as expected (outputting "Bare text content" and "<this is some CDATA>", without 
the "truncation" you reported separately in ##php:

<?php
$xml = <<<EOX
<root>
    <element>Bare text content</element>
    <element><![CDATA[<this is some CDATA>]]></element>
</root>
EOX;

function cdata_handler($parser, $data) {
    if (trim($data)) {      // ignore whitespace
        var_dump($data);
    }
}

$parser = xml_parser_create();
xml_set_character_data_handler($parser, 'cdata_handler');
xml_parse($parser, $xml);
?>

You should follow this up with a support channel, such as ##php or those listed at 
http://www.php.net/support.php, as this bug system is not a support forum. If you 
are able to reduce this to a self-contained, short example (such as that above) 
that shows a clear regression from PHP 5.2 to 5.3, please reopen this bug with 
that example.

Thank you for your interest in PHP.
 [2012-03-14 02:19 UTC] aharvey@php.net
-Status: Open +Status: Not a bug -Package: XMLRPC-EPI related +Package: XML related
 [2012-03-14 02:31 UTC] thephpguru at hotmail dot com
Dooooooooooooopppee. My complex script gets reduced to a simpler script. I will try it your way.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 13:01:28 2024 UTC