|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-04-08 16:15 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2021-04-08 16:15 UTC] cmb@php.net
[2021-04-18 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
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}@'.