php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31076 schemaValidate crashing on empty xs:token
Submitted: 2004-12-14 01:46 UTC Modified: 2004-12-21 07:41 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: c dot d at earthlink dot net Assigned:
Status: No Feedback Package: DOM XML related
PHP Version: 5.0.2 OS: Mac OS X 10.3.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: c dot d at earthlink dot net
New email:
PHP Version: OS:

 

 [2004-12-14 01:46 UTC] c dot d at earthlink dot net
Description:
------------
When an XML file has an empty element defined as xs:token in XSD, and it is loaded into a DOMDocument and then schemaValidate is called, the server CPU begins to race and content is never returned to browser.

The W3C definition of xs:token does not prohibit empty xs:token elements.  



Reproduce code:
---------------
$aDOM = new DOMDocument("1.0");
$aDOM->load("file.xml");
$aDOM->schemaValidate("file.xsd");

XML File:

<?xml version="1.0"?>
<people>
     <person>
         <fname>John</fname>
         <mname/>
         <lname>Doe</lname>
     </person>
</people>

XSD File:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="people">
     <xs:complexType>
         <xs:sequence>
             <xs:element name="person" type="persontype" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
</xs:element>

<xs:complexType name="persontype">
     <xs:sequence>
         <xs:element name="fname" type="xs:token"/>
         <xs:element name="mfname" type="xs:token"/>
         <xs:element name="lfname" type="xs:token"/>
     </xs:sequence>
</xs:complexType>

</xs:schema>


Expected result:
----------------
schemaValidate should return true.

Actual result:
--------------
CPU races, server does not return content to browser.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-14 10:24 UTC] chregu@php.net
Works for me, except that it doesn't validate...

Which libxml2 version are you using?

The XML Schema parser in libxml2 isn't complete yet, but it is recommended to use one of the latest libxml2 releases, as the XML Schema implementation got some big improvements lately 
 [2004-12-14 10:34 UTC] c dot d at earthlink dot net
Further Information:

My libxml version: 2.6.7
My DOM/XML API version :20031129
 [2004-12-14 10:35 UTC] chregu@php.net
Please use a newer libxml2 library and see if it still hangs.
 [2004-12-21 07:41 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2005-09-28 16:11 UTC] jean-pierre dot huart at brussels dot msf dot org
This is not solved in Version 5.0.5 with libxml2 version 2.6.11 on apache http server 2.0.54 on windows 2000.

The bugs happens also when declaring an xs:boolean type in XSD, but not with xs:string, xs:long, xs:date.

Actual result:
Application error
"the instruction at "0x0070dcc3" referenced memory at 0x00000000. The memory could not be "read".

I hope that this bug will be re-opened.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC