From:             apc at hotmail dot kg
Operating system: Windows XP Pro SP2
PHP version:      4.4.0
PHP Bug Type:     *XML functions
Bug description:  Cannot reuse XML parser, get "junk after document element" 
error message

Description:
------------
When I try to parse XML into struct twice using the same parser - second
attempt fails.

Reproduce code:
---------------
<?php
$t=('../test/eg_snews.xml'); // any XML file

      $XMLContent = file_get_contents($t);

      $th = xml_parser_create(); 

                echo "<hr>";
      var_dump(xml_parse_into_struct ($th, $XMLContent, $V)); ;
      echo "<br>Result size: ".sizeof($V);
                echo "<br>Error code: ".$ec=xml_get_error_code($th);
                echo "<br>Error text: ".xml_error_string($ec);      

                echo "<hr>";
      var_dump(xml_parse_into_struct ($th, $XMLContent, $V)); ;
      echo "<br>Result size: ".sizeof($V);
                echo "<br>Error code: ".$ec=xml_get_error_code($th);
                echo "<br>Error text: ".xml_error_string($ec);      
?>

Expected result:
----------------
int(1) 
Result size: 301
Error code: 0
Error text: 

int(1) 
Result size: 301
Error code: 0
Error text: 

Actual result:
--------------
int(1) 
Result size: 301
Error code: 0
Error text: 

int(0) 
Result size: 0
Error code: 9
Error text: junk after document element

-- 
Edit bug report at http://bugs.php.net/?id=34707&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34707&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34707&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34707&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34707&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34707&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34707&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34707&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34707&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34707&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34707&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34707&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34707&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34707&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34707&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34707&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34707&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34707&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34707&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34707&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34707&r=mysqlcfg

Reply via email to