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 2020 }
2121 ],
2222 "require" : {
23- "ext-ctype" : " *" ,
2423 "ext-dom" : " *" ,
2524 "php" : " >=5.3.0"
2625 },
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ protected function consumeData()
137137 $ this ->endTag ();
138138 } elseif ('? ' === $ tok ) {
139139 $ this ->processingInstruction ();
140- } elseif (ctype_alpha ($ tok )) {
140+ } elseif ($ this -> is_alpha ($ tok )) {
141141 $ this ->tagName ();
142142 } else {
143143 $ this ->parseError ('Illegal tag opening ' );
@@ -347,7 +347,7 @@ protected function endTag()
347347 // > -> parse error
348348 // EOF -> parse error
349349 // -> parse error
350- if (!ctype_alpha ($ tok )) {
350+ if (!$ this -> is_alpha ($ tok )) {
351351 $ this ->parseError ("Expected tag name, got '%s' " , $ tok );
352352 if ("\0" == $ tok || false === $ tok ) {
353353 return false ;
@@ -1194,4 +1194,18 @@ protected function decodeCharacterReference($inAttribute = false)
11941194
11951195 return '& ' ;
11961196 }
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+ }
11971211}
You can’t perform that action at this time.
0 commit comments