Bug #63942 [Opn->Fbk]: schemaValidate pattern fails with quantities

From: Date: Thu, 08 Apr 2021 16:15:06 +0000
Subject: Bug #63942 [Opn->Fbk]: schemaValidate pattern fails with quantities
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233323@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63942&edit=1 ID: 63942 Updated by: cmb@php.net Reported by: jknoos at kth dot se Summary: schemaValidate pattern fails with quantities -Status: Open +Status: Feedback Type: Bug Package: DOM XML related Operating System: Arch Linux PHP Version: 5.4.10 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: 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] <https://www.php.net/supported-versions.php> Previous Comments: ------------------------------------------------------------------------ [2013-01-08 17:05:39] jknoos at kth dot se 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 this bug report at https://bugs.php.net/bug.php?id=63942&edit=1

« previous php.bugs (#233323) next »