Tokenizer: don't strip backslashes from \x

Bug: T238475
Change-Id: I8c2ea6ad369946df93440eece60d456dc1a3fd7a
This commit is contained in:
Daimona Eaytoy 2019-11-16 16:17:04 +01:00
parent a0b349d4c3
commit c73381b6db
2 changed files with 8 additions and 3 deletions

View file

@ -7,7 +7,7 @@ use Psr\Log\LoggerInterface;
*/
class AbuseFilterTokenizer {
/** @var int Tokenizer cache version. Increment this when changing the syntax. **/
const CACHE_VERSION = 2;
const CACHE_VERSION = 3;
const COMMENT_START_RE = '/\s*\/\*/A';
const ID_SYMBOL_RE = '/[0-9A-Za-z_]+/A';
const OPERATOR_RE =
@ -307,7 +307,7 @@ class AbuseFilterTokenizer {
// \xXX -- 2 done later
$offset += 2;
} else {
$token .= 'x';
$token .= '\\x';
}
break;
default:

View file

@ -3,4 +3,9 @@
"a\"b" === 'a"b' &
"a\rb" !== "a\r\nb" &
"\x66\x6f\x6f" === "foo" &
"some\xstring" === "somexstring"
"some\xstring" === "some\\xstring" &
"some\vstring" === "some\\vstring" &
/* T238475 */
'\x{}' === '\x' + '{}' &
length('\x{}') === 4 &
'foobar' rlike '[\x{61}-\x{7a}]'