From: jknoos at kth dot se
Operating system: Arch Linux
PHP version: 5.4.10
Package: DOM XML related
Bug Type: Bug
Bug description:schemaValidate pattern fails with quantities
Description:
------------
When using the function DOMDocument::schemaValidate, the string x@ is
matched by ".(\.{0,1}){0}@" but not by ".(\.?){0}@" (i.e., the only
difference is {0,1} vs. ?).
Test script:
---------------
Code:
$xdoc = new DomDocument;
$xdoc->loadXML( file_get_contents( 'xml.xml' ) );
$xdoc->schemaValidate( 'schema.xsd' );
Schema, schema.xsd:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="a">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value=".(\.{0,1}){0}@"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:schema>
xml.xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<a>x@</a>
Expected result:
----------------
Validation expected.
Actual result:
--------------
Warning: DOMDocument::schemaValidate(): Element 'a': [facet 'pattern'] The
value 'x@' is not accepted by the pattern '.(\.{0,1}){0}@'.
--
Edit bug report at https://bugs.php.net/bug.php?id=63942&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63942&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63942&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63942&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63942&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63942&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63942&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63942&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63942&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63942&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63942&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63942&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63942&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63942&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63942&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63942&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63942&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63942&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63942&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63942&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63942&r=mysqlcfg