-
-
Notifications
You must be signed in to change notification settings - Fork 685
Closed
Description
When a regex pattern created directly using the constructor that contains a null character, it does not match properly on Eval, Neko, C++, lua, and Hashlink. PHP throws an error on the first match call due of the null character (Null byte in regex
).
final containingNull = new EReg("abc\x00def", "");
trace(containingNull.match("abc")); // true, should be false
trace(containingNull.match("abc\x00def")); // true
trace(containingNull.match("abc\x00fed")); // true, should be false
On all other targets it works as expected.
On the other hand, the following works fine on (almost) all targets, where we use the regex literal syntax.
final containingNull = ~/abc\x00def/;
trace(containingNull.match("abc")); // false
trace(containingNull.match("abc\x00def")); // true (apart from on hashlink)
trace(containingNull.match("abc\x00fed")); // false
Targets affected:
- Neko - Migrate to pcre2 neko#249
- Lua - [lua] Use lrexlib-pcre2 for regular expressions #11030
- C++ - Migrate to pcre2 hxcpp#1037
- Hashlink
- Eval - [eval] Migrate to pcre2 #11032
-
PHPdue to a PHP bug