|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19562 xml_parse_into_struct does not follow XML 1.0 specs w.r.t. default attributes
Submitted: 2002-09-23 13:21 UTC Modified: 2002-11-28 07:30 UTC
From: mmicu at voyanttech dot com Assigned:
Status: Closed Package: XML related
PHP Version: 4.2.3 OS: Solaris 2.8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mmicu at voyanttech dot com
New email:
PHP Version: OS:


 [2002-09-23 13:21 UTC] mmicu at voyanttech dot com
XML 1.0 specs say that default attribute values will be parsed as if those attributes were directly specified:

From the XML 1.0 Spec (

"[Definition: If the declaration is neither #REQUIRED nor #IMPLIED, then the AttValue value contains the declared default value; the #FIXED keyword states that the attribute must always have the default value. If a default value is declared, when an XML processor encounters an omitted attribute, it is to behave as though the attribute were present with the declared default value.]"

I have the following DTD:

<!ELEMENT J ...>
<!ATTLIST J att #FIXED 20>

and the following XML:


The xml_parse_into_struct function does NOT place the attribute "att=20" into the struct.  Furthermore, if I change the XML to read:

<J att=45>

xml_parse_into_struct WILL place the attribute "att=45" into the struct (so non-default attributes DO work), but in actuality, this should fail, because the #FIXED keyword specifies that the value cannot be changed.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-28 07:30 UTC]
xml_parse_into_struct uses expat as xml-parser and expat is a non-validating parser which does not care about DTDs (AFAIK)

 [2004-07-26 17:55 UTC] qwer70019 at hotmail dot com
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Dec 03 17:03:34 2021 UTC