From:             jona at oismail dot com
Operating system: Windows 2000
PHP version:      5.1.4
PHP Bug Type:     Reproducible crash
Bug description:  DOM->schemaValidate causes an access violation

Description:
------------
When an unescaped & is encounted in an XML document, PHP causes an access
violation in IIS when DOM schemaValidate or DOM schemaValidateSource is
called.
I have PHP running as an ISAPI module using the php5isapi.dll

Reproduce code:
---------------
<?php
$sXML = '<?xml version="1.0" encoding="ISO-8859-5"?>
<root type="input" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="input.xsd">
<username>Jona&</username>
</root>';

$sSchema = '<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="string">
        <xs:restriction base="xs:string">
                <xs:minLength value="1" />
        </xs:restriction>
</xs:simpleType>

<xs:element name="root">
        <xs:complexType>                        
                <xs:choice>
                        <xs:element name="username" type="string" />
                        <xs:element name="password" type="string" />
                </xs:choice>
                <xs:attribute name="type" type="xs:string" use="required" 
fixed="input"
/>
        </xs:complexType>
</xs:element>
</xs:schema>';

$obj_DOM = new DOMDocument("1.0", "ISO-8859-5");
$obj_DOM->loadXML(trim($sXML) );

$obj_DOM->schemaValidateSource($sSchema);
?>

Expected result:
----------------
Warning thrown along the lines of "Invalid XML document" or schemaValidate
returns false.

Actual result:
--------------
PHP has encountered an Access Violation at 01B1E093
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]:
xmlParseEntityRef: no name in Entity, line: 3 in
D:\www\php5api\webroot\xml_schema_test.php on line 27

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

Reply via email to