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 "ext-libxml" : " *" ,
2625 "php" : " >=5.3.0"
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 ;
@@ -1188,4 +1188,18 @@ protected function decodeCharacterReference($inAttribute = false)
11881188
11891189 return '& ' ;
11901190 }
1191+
1192+ /**
1193+ * Checks whether a (single-byte) character is an ASCII letter or not.
1194+ *
1195+ * @param string $input A single-byte string
1196+ *
1197+ * @return bool True if it is a letter, False otherwise
1198+ */
1199+ protected function is_alpha ($ input )
1200+ {
1201+ $ code = ord ($ input );
1202+
1203+ return ($ code >= 97 && $ code <= 122 ) || ($ code >= 65 && $ code <= 90 );
1204+ }
11911205}
You can’t perform that action at this time.
0 commit comments