|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60651 XSD schema validation problem with unicode regular expression
Submitted: 2012-01-04 10:31 UTC Modified: 2020-03-10 08:32 UTC
Avg. Score:4.4 ± 0.7
Reproduced:9 of 9 (100.0%)
Same Version:3 (33.3%)
Same OS:6 (66.7%)
From: webmaster at panservice dot it Assigned: cmb (profile)
Status: Not a bug Package: *XML functions
PHP Version: Irrelevant OS: 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: webmaster at panservice dot it
New email:
PHP Version: OS:


 [2012-01-04 10:31 UTC] webmaster at panservice dot it
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 

<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();



$dom = new DOMDocument();

if ( !$dom->schemaValidate('test.xsd') ) {
  echo "XML Error\n";
} else {
  echo "XML ok\n";

XSD Schema:

<xsd:schema xmlns:xsd="" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xsd:simpleType name="noLowerCase">
		<xsd:restriction base="xsd:string">
			<xsd:pattern value="[\P{Ll}]+"/>
	<xsd:complexType name="DatiUtenteType">
			<xsd:element name="Cognome" type="noLowerCase"/>
			<xsd:element name="Nome" type="noLowerCase"/>
	<xsd:complexType name="DataExchangeFisso">
			<xsd:element name="DatiUtente" type="DatiUtenteType"/>
	<xsd:element name="ListOfDataExchange">
				<xsd:element name="DataExchangeFisso" type="DataExchangeFisso" minOccurs="0" maxOccurs="unbounded"/>

XML File:

<?xml version="1.0" encoding="UTF-8"?>

Expected result:
XML ok

Actual result:
XML Error
    [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



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-10 08:32 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-03-10 08:32 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

\P{Ll} inside a character class is not recognized as Unicode
character property escape sequence.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 24 20:01:30 2024 UTC