|  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: 2021-04-18 04:22 UTC
From: jknoos at kth dot se Assigned: cmb (profile)
Status: No Feedback Package: DOM XML related
PHP Version: 5.4.10 OS: Arch Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jknoos at kth dot se
New email:
PHP Version: OS:


 [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


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-08 16:15 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-04-08 16:15 UTC]
This is likely a libxml2 issue which apparently has been fixed in
the meantime; the script works as expected with libxml2 2.9.10.

Or do you still experience this issue with any of the actively
supported PHP versions[1]?  If so, what's your libxml2 version?

[1] <>
 [2021-04-18 04:22 UTC] php-bugs at lists dot php dot 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 "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 16:01:30 2024 UTC