Skip to content

Commit 726686d

Browse files
committed
unicode is a range
1 parent 505fef8 commit 726686d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Jms/YamlValidatorConverter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ private function loadValidatorType(array &$property, Type $type, $arrayized = fa
146146
// initial support for https://www.w3.org/TR/xsd-unicode-blocknames/
147147
// not supported by standard php regex implementation
148148
$regexPattern = strtr($item['value'], [
149-
'\p{IsBasicLatin}' => '\x00-\x7F',
150-
'\p{IsIsBasicLatin}' => '\x{0000}-\x{007F}',
151-
'\p{IsLatin-1Supplement}' => '\x{0080}-\x{00FF}',
152-
'\p{IsLatinExtended-A}' => '\x{0100}-\x{024F}',
153-
'\p{IsLatinExtended-B}' => '\x{0180}-\x{024F}',
149+
'\p{IsBasicLatin}' => '[\x00-\x7F]',
150+
'\p{IsIsBasicLatin}' => '[\x{0000}-\x{007F}]',
151+
'\p{IsLatin-1Supplement}' => '[\x{0080}-\x{00FF}]',
152+
'\p{IsLatinExtended-A}' => '[\x{0100}-\x{024F}]',
153+
'\p{IsLatinExtended-B}' => '[\x{0180}-\x{024F}]',
154154
]);
155155
$rules[] = [
156156
'Regex' => ['pattern' => "~{$regexPattern}~"],

tests/Converter/Validator/Xsd2ValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ public function getRestrictionsValidations()
126126
],
127127
// pattern / Regex
128128
[
129-
'<xs:pattern value="[\\p{IsBasicLatin}\\p{IsLatin-1Supplement}]+"/>',
129+
'<xs:pattern value="\\p{IsBasicLatin}\\p{IsLatin-1Supplement}"/>',
130130
[
131131
[
132132
'Regex' => [
133-
'pattern' => '~[\\x00-\\x7F\\x{0080}-\\x{00FF}]+~',
133+
'pattern' => '~[\\x00-\\x7F][\\x{0080}-\\x{00FF}]~',
134134
'groups' => ['xsd_rules'],
135135
],
136136
],

0 commit comments

Comments
 (0)