Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

#28207 [Ver->Bgs]: Wrong output in PHP 5 with XML Parser Functions

0 views
Skip to first unread message

rric...@php.net

unread,
Aug 31, 2005, 10:45:31 PM8/31/05
to
ID: 28207
Updated by: rric...@php.net
Reported By: bart at mediawave dot nl
-Status: Verified
+Status: Bogus
Bug Type: XML related
Operating System: *
PHP Version: 5CVS, 4CVS (2005-07-31)
New Comment:

Entity issues have been fixed for a while. The remaining issues here
are default handler issues.
See Bug #27908
Marking bogus as half of the issues fixed and the rest in already
reported


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

[2005-07-31 20:59:07] sni...@php.net

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


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

[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

0 new messages