|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63942 schemaValidate pattern fails with quantities
Submitted: 2013-01-08 17:05 UTC Modified: -
From: jknoos at kth dot se Assigned:
Status: Open Package: DOM XML related
PHP Version: 5.4.10 OS: Arch Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-01-08 17:05 UTC] jknoos at kth dot se
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:
    $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="">
        <xs:element name="a">
                <xs:restriction base="xs:string">
                    <xs:pattern value=".(\.{0,1}){0}@"></xs:pattern>

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>

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}@'.


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC