ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#28207 [Opn->Ver]: Wrong output in PHP 5 with XML Parser Functions
by sniper other posts by this author
Jul 31 2005 11:59AM messages near this date
#28207 [Ver->Bgs]: Wrong output in PHP 5 with XML Parser Functions | #28207 [Opn->Asn]: Wrong output in PHP 5 with XML Parser Functions
ID:               28207
 Updated by:       sniper@[...].net
 Reported By:      bart at mediawave dot nl
-Status:           Open
+Status:           Verified
 Bug Type:         XML related
 Operating System: *
-PHP Version:      5CVS, 4CVS (2005-02-21)
+PHP Version:      5CVS, 4CVS (2005-07-30)
 New Comment:

Happens when ext/xml is compiled with libxml instead of expat.



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

[2005-02-22 21:58:49] joern_h at gmx dot net

It seems that entity refs do not get expanded when there is a default
handler registered. Instead the default handler gets called with the
name of the entity. Surprisingly this behavior is the same in PHP4 and
PHP5 (tested with latest snapshots).

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

[2004-04-28 17:18:12] bart at mediawave dot nl

Description:
------------
The stream-oriented XML parser (formerly Expat) produces different
output in PHP 5 than it did in PHP 4. I'm unable to read the 

<?xml version='1.0'?> 
<!DOCTYPE chapter SYSTEM "/just/a/test.dtd" [
<!ENTITY plainEntity "FOO entity"> 
<!ENTITY systemEntity SYSTEM "xmltest2.xml"> 
]> 

section of the XML document with PHP 5.

Reproduce code:
---------------
The code under "Example 3. External Entity Example" at
http://www.php.net/manual/en/ref.xml.php

Expected result:
----------------
<?xml version='1.0'?> 
<!DOCTYPE chapter SYSTEM "/just/a/test.dtd" [
<!ENTITY plainEntity "FOO entity"> 
<!ENTITY systemEntity SYSTEM "xmltest2.xml"> 
]> 
<CHAPTER> 
 <TITLE> Title &plainEntity;</TITLE>
 <PARA> 
  <INFORMALTABLE> 
   <TGROUP COLS="3"> 
    <TBODY> 
     <ROW> <ENTRY>a1</ENTRY><ENTRY
MOREROWS="1"> b1</ENTRY><ENTRY>c1</ENTRY></ROW>
     <ROW> <ENTRY>a2</ENTRY><ENTRY>c2</ENTRY></ROW>
     <ROW> <ENTRY>a3</ENTRY><ENTRY>b3</ENTRY><ENTRY>c3</ENTRY></ROW>
    </TBODY> 
   </TGROUP> 
  </INFORMALTABLE> 
 </PARA> 
 <?xml version="1.0"?> 
<!DOCTYPE foo [
<!ENTITY testEnt "test entity"> 
]> 
<FOO> 
   <ELEMENT ATTRIB="value"> </ELEMENT>
   &testEnt;
   This is some more PHP code being executed.
</FOO> 
 <SECTION ID="about"> 
  <TITLE> About this Document</TITLE>
  <PARA> 
   <!-- this is a comment --> 
   Hi!  This is PHP version 4.3.6
  </PARA> 
 </SECTION> 
</CHAPTER> 

parse complete

Actual result:
--------------
&plainEntity;<CHAPTER> 
 <TITLE> Title &plainEntity;</TITLE>
 <PARA> 
  <INFORMALTABLE> 
   <TGROUP COLS="3"> 
    <TBODY> 
     <ROW> <ENTRY>a1</ENTRY><ENTRY
MOREROWS="1"> b1</ENTRY><ENTRY>c1</ENTRY></ROW>
     <ROW> <ENTRY>a2</ENTRY><ENTRY>c2</ENTRY></ROW>
     <ROW> <ENTRY>a3</ENTRY><ENTRY>b3</ENTRY><ENTRY>c3</ENTRY></ROW>
    </TBODY> 
   </TGROUP> 
  </INFORMALTABLE> 
 </PARA> 
 &systemEntity;
 <SECTION ID="about"> 
  <TITLE> About this Document</TITLE>
  <PARA> 
   <-- this is a comment --> 
   Hi!  This is PHP version 5.0.0RC2
  </PARA> 
 </SECTION> 
</CHAPTER> XML error: Undeclared entity warning at line 27


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


-- 
Edit this bug report at http://bugs.php.net/?id=28207&edit=1
Thread:
bart at mediawave dot nl
rrichards
sniper

Joern_h At Gmx Dot Net
Bart At Mediawave Dot Nl

Bart At Mediawave Dot Nl
Bart At Mediawave Dot Nl


bart at mediawave dot nl

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved