22
22
class Escaper
23
23
{
24
24
// Characters that would cause a dumped string to require double quoting.
25
- const REGEX_CHARACTER_TO_ESCAPE = "[ \\x00- \\x1f]| \xc2\x85| \xc2\xa0| \xe2\x80\xa8| \xe2\x80\xa9" ;
25
+ const REGEX_CHARACTER_TO_ESCAPE = "[ \\x00- \\x1f]| \x7f | \ xc2\x85| \xc2\xa0| \xe2\x80\xa8| \xe2\x80\xa9" ;
26
26
27
27
// Mapping arrays for escaping a double quoted string. The backslash is
28
28
// first to ensure proper escaping because str_replace operates iteratively
@@ -33,13 +33,15 @@ class Escaper
33
33
"\x08" , "\x09" , "\x0a" , "\x0b" , "\x0c" , "\x0d" , "\x0e" , "\x0f" ,
34
34
"\x10" , "\x11" , "\x12" , "\x13" , "\x14" , "\x15" , "\x16" , "\x17" ,
35
35
"\x18" , "\x19" , "\x1a" , "\x1b" , "\x1c" , "\x1d" , "\x1e" , "\x1f" ,
36
+ "\x7f" ,
36
37
"\xc2\x85" , "\xc2\xa0" , "\xe2\x80\xa8" , "\xe2\x80\xa9" ,
37
38
];
38
39
private static $ escaped = ['\\\\' , '\\" ' , '\\\\' , '\\" ' ,
39
40
'\\0 ' , '\\x01 ' , '\\x02 ' , '\\x03 ' , '\\x04 ' , '\\x05 ' , '\\x06 ' , '\\a ' ,
40
41
'\\b ' , '\\t ' , '\\n ' , '\\v ' , '\\f ' , '\\r ' , '\\x0e ' , '\\x0f ' ,
41
42
'\\x10 ' , '\\x11 ' , '\\x12 ' , '\\x13 ' , '\\x14 ' , '\\x15 ' , '\\x16 ' , '\\x17 ' ,
42
43
'\\x18 ' , '\\x19 ' , '\\x1a ' , '\\e ' , '\\x1c ' , '\\x1d ' , '\\x1e ' , '\\x1f ' ,
44
+ '\\x7f ' ,
43
45
'\\N ' , '\\_ ' , '\\L ' , '\\P ' ,
44
46
];
45
47
0 commit comments