]> granicus.if.org Git - php/commitdiff
Add additional preg_match test case
authorGraham Campbell <graham@alt-three.com>
Tue, 7 Apr 2020 13:41:06 +0000 (15:41 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 22 Apr 2020 13:02:08 +0000 (15:02 +0200)
ext/pcre/tests/preg_match_latin.phpt [new file with mode: 0644]

diff --git a/ext/pcre/tests/preg_match_latin.phpt b/ext/pcre/tests/preg_match_latin.phpt
new file mode 100644 (file)
index 0000000..8f1d189
--- /dev/null
@@ -0,0 +1,35 @@
+--TEST--
+preg_match() single line match with latin input
+--FILE--
+<?php
+/* Prototype  : int preg_match  ( string $pattern  , string $subject  [, array &$matches  [, int $flags  [, int $offset  ]]] )
+ * Description: Perform a regular expression match
+ * Source code: ext/pcre/php_pcre.c
+ */
+
+preg_match('/^[\w\p{Cyrillic}\s\-\']+$/u', 'latin', $test1);
+preg_match('/^[\w\p{Cyrillic}\s\-\']+$/u', 'кириллица', $test2);
+preg_match('/^[\w\s\-\']+$/u', 'latin', $test3);
+
+var_dump([$test1, $test2, $test3]);
+?>
+===Done===
+--EXPECT--
+array(3) {
+  [0]=>
+  array(1) {
+    [0]=>
+    string(5) "latin"
+  }
+  [1]=>
+  array(1) {
+    [0]=>
+    string(18) "кириллица"
+  }
+  [2]=>
+  array(1) {
+    [0]=>
+    string(5) "latin"
+  }
+}
+===Done===