@@ -39,7 +39,7 @@ protected function setUp()
39
39
}
40
40
41
41
/**
42
- * Convert a Unicode Codepoint to a literal UTF-8 character.
42
+ * Convert a unicode codepoint to a literal UTF-8 character
43
43
*
44
44
* @param int $codepoint Unicode codepoint in hex notation
45
45
* @return string UTF-8 literal string
@@ -51,26 +51,27 @@ protected function codepointToUtf8($codepoint)
51
51
}
52
52
if ($ codepoint < 0x800 ) {
53
53
return chr ($ codepoint >> 6 & 0x3f | 0xc0 )
54
- . chr ($ codepoint & 0x3f | 0x80 );
54
+ . chr ($ codepoint & 0x3f | 0x80 );
55
55
}
56
56
if ($ codepoint < 0x10000 ) {
57
57
return chr ($ codepoint >> 12 & 0x0f | 0xe0 )
58
- . chr ($ codepoint >> 6 & 0x3f | 0x80 )
59
- . chr ($ codepoint & 0x3f | 0x80 );
58
+ . chr ($ codepoint >> 6 & 0x3f | 0x80 )
59
+ . chr ($ codepoint & 0x3f | 0x80 );
60
60
}
61
61
if ($ codepoint < 0x110000 ) {
62
62
return chr ($ codepoint >> 18 & 0x07 | 0xf0 )
63
- . chr ($ codepoint >> 12 & 0x3f | 0x80 )
64
- . chr ($ codepoint >> 6 & 0x3f | 0x80 )
65
- . chr ($ codepoint & 0x3f | 0x80 );
63
+ . chr ($ codepoint >> 12 & 0x3f | 0x80 )
64
+ . chr ($ codepoint >> 6 & 0x3f | 0x80 )
65
+ . chr ($ codepoint & 0x3f | 0x80 );
66
66
}
67
- throw new \Exception ('Codepoint requested outside of Unicode range ' );
67
+ throw new \Exception ('Codepoint requested outside of unicode range ' );
68
68
}
69
69
70
70
public function testEscapeJsEscapesOwaspRecommendedRanges ()
71
71
{
72
- $ immune = [', ' , '. ' , '_ ' ]; // Exceptions to escaping ranges
73
- for ($ chr =0 ; $ chr < 0xFF ; $ chr ++) {
72
+ // Exceptions to escaping ranges
73
+ $ immune = [', ' , '. ' , '_ ' ];
74
+ for ($ chr = 0 ; $ chr < 0xFF ; $ chr ++) {
74
75
if ($ chr >= 0x30 && $ chr <= 0x39
75
76
|| $ chr >= 0x41 && $ chr <= 0x5A
76
77
|| $ chr >= 0x61 && $ chr <= 0x7A
0 commit comments