File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 20
20
}
21
21
],
22
22
"require" : {
23
- "ext-ctype" : " *" ,
24
23
"ext-dom" : " *" ,
25
24
"php" : " >=5.3.0"
26
25
},
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ protected function consumeData()
137
137
$ this ->endTag ();
138
138
} elseif ('? ' === $ tok ) {
139
139
$ this ->processingInstruction ();
140
- } elseif (ctype_alpha ($ tok )) {
140
+ } elseif ($ this -> is_alpha ($ tok )) {
141
141
$ this ->tagName ();
142
142
} else {
143
143
$ this ->parseError ('Illegal tag opening ' );
@@ -347,7 +347,7 @@ protected function endTag()
347
347
// > -> parse error
348
348
// EOF -> parse error
349
349
// -> parse error
350
- if (!ctype_alpha ($ tok )) {
350
+ if (!$ this -> is_alpha ($ tok )) {
351
351
$ this ->parseError ("Expected tag name, got '%s' " , $ tok );
352
352
if ("\0" == $ tok || false === $ tok ) {
353
353
return false ;
@@ -1194,4 +1194,18 @@ protected function decodeCharacterReference($inAttribute = false)
1194
1194
1195
1195
return '& ' ;
1196
1196
}
1197
+
1198
+ /**
1199
+ * Checks whether a (single-byte) character is an ASCII letter or not.
1200
+ *
1201
+ * @param string $input A single-byte string
1202
+ *
1203
+ * @return bool True if it is a letter, False otherwise
1204
+ */
1205
+ protected function is_alpha ($ input )
1206
+ {
1207
+ $ code = ord ($ input );
1208
+
1209
+ return ($ code >= 97 && $ code <= 122 ) || ($ code >= 65 && $ code <= 90 );
1210
+ }
1197
1211
}
You can’t perform that action at this time.
0 commit comments