ID:               50156
 Updated by:       j...@php.net
 Reported By:      edwin at bitstorm dot org
-Status:           Open
+Status:           Feedback
 Bug Type:         XML Reader
 Operating System: Ubuntu 9.04
 PHP Version:      5.2SVN-2009-11-12 (SVN)
 New Comment:

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.

And please check from phpinfo() whether your xml extension is compiled
with libexpat or libxml (version is shown there).


Previous Comments:
------------------------------------------------------------------------

[2009-11-12 13:48:14] edwin at bitstorm dot org

Description:
------------
Element <a></a> returns twice, one for XMLReader::ELEMENT and one for
XMLReader::END_ELEMENT.

Element <a/> returns once, for XMLReader::ELEMENT.

That should return a XMLReader::END_ELEMENT too, because that's
implicit.

Problem is that now you can't distinguish between <a><b> and <a/><b>
and that's a bug.

Reproduce code:
---------------
  $reader = new XMLReader();
  $reader->open($file);
  echo "<table>\n";
  while ($reader->read()) {
    echo "<tr><td>".$reader->nodeType."</td><td>".$node =
$reader->name."</td><td>".$reader->value."</td></tr>\n";
  }
  echo "</table>\n";


Input:

<Titles>
  <Title>
    <ID>429</ID>
    <Type />
    <Barcode>
    </Barcode>


Expected result:
----------------
1       Titles  
14      #text   
1       Title   
14      #text   
1       ID      
3       #text   429
15      ID      
14      #text   
1       Type    
14      #text   
15      Type    
14      #text   
1       Barcode 
14      #text   
15      Barcode
14      #text

Actual result:
--------------
1       Titles  
14      #text   
1       Title   
14      #text   
1       ID      
3       #text   429
15      ID      
14      #text   
1       Type    
14      #text   
1       Barcode 
14      #text   
15      Barcode
14      #text


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50156&edit=1

Reply via email to