From:             c dot d at earthlink dot net
Operating system: Mac OS X 10.3.6
PHP version:      5.0.2
PHP Bug Type:     DOM XML related
Bug description:  schemaValidate crashing on empty xs:token

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.

-- 
Edit bug report at http://bugs.php.net/?id=31076&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31076&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31076&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31076&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31076&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31076&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31076&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31076&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31076&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31076&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31076&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31076&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31076&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31076&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31076&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31076&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31076&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31076&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31076&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31076&r=mysqlcfg

Reply via email to