From: Operating system: Linux PHP version: Irrelevant Package: *XML functions Bug Type: Bug Bug description:XSD schema validation problem with unicode regular expression
Description: ------------ When I try to validate XML file with given XSD schema containing Unicode regular expression, the function DOMDocument::schemaValidate return a validation error. The XSD schema is W3C well formed and the validation pass with the other validation tools. The problem doesn't occur if the XSD pattern is format like this (without square brackets): <xsd:pattern value="\P{Ll}+"/> PHP Version: 5.2.14 LibXml Version: 2.7.7 PS: The previous pattern [\P{Ll}]+ works correctly with preg_match function. Test script: --------------- PHP Validation Code: function libxml_display_errors() { $errors = libxml_get_errors(); print_r($errors); libxml_clear_errors(); } libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->load('test.xml'); if ( !$dom->schemaValidate('test.xsd') ) { echo "XML Error\n"; libxml_display_errors(); } else { echo "XML ok\n"; } ------------------------------- XSD Schema: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:simpleType name="noLowerCase"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[\P{Ll}]+"/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="DatiUtenteType"> <xsd:sequence> <xsd:element name="Cognome" type="noLowerCase"/> <xsd:element name="Nome" type="noLowerCase"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="DataExchangeFisso"> <xsd:sequence> <xsd:element name="DatiUtente" type="DatiUtenteType"/> </xsd:sequence> </xsd:complexType> <xsd:element name="ListOfDataExchange"> <xsd:complexType> <xsd:sequence> <xsd:element name="DataExchangeFisso" type="DataExchangeFisso" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> ------------------------------- XML File: <?xml version="1.0" encoding="UTF-8"?> <ListOfDataExchange> <DataExchangeFisso> <DatiUtente> <Cognome>FOO</Cognome> <Nome>BAR</Nome> </DatiUtente> </DataExchangeFisso> </ListOfDataExchange> Expected result: ---------------- XML ok Actual result: -------------- XML Error Array ( [0] => LibXMLError Object ( [level] => 2 [code] => 1839 [column] => 0 [message] => Element 'Cognome': [facet 'pattern'] The value 'FOO' is not accepted by the pattern '[\P{Ll}]+'. [file] => /var/www/html/test.xml [line] => 5 ) [1] => LibXMLError Object ( [level] => 2 [code] => 1824 [column] => 0 [message] => Element 'Cognome': 'FOO' is not a valid value of the atomic type 'noLowerCase'. [file] => /var/www/html/test.xml [line] => 5 ) [2] => LibXMLError Object ( [level] => 2 [code] => 1839 [column] => 0 [message] => Element 'Nome': [facet 'pattern'] The value 'BAR' is not accepted by the pattern '[\P{Ll}]+'. [file] => /var/www/html/test.xml [line] => 6 ) [3] => LibXMLError Object ( [level] => 2 [code] => 1824 [column] => 0 [message] => Element 'Nome': 'BAR' is not a valid value of the atomic type 'noLowerCase'. [file] => /var/www/html/test.xml [line] => 6 ) ) -- Edit bug report at https://bugs.php.net/bug.php?id=60651&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60651&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60651&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60651&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60651&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60651&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60651&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60651&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60651&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60651&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60651&r=support Expected behavior: https://bugs.php.net/fix.php?id=60651&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60651&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60651&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60651&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60651&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60651&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60651&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60651&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60651&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60651&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60651&r=mysqlcfg