← All changes
|
vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php
+7
-2
3.20.2
→
3.24.2
View file →
| @@ -506,9 +506,9 @@ | ||
| 506 | 506 | // 8.1.2.3 |
| 507 | 507 | $this->scanner->whitespace(); |
| 508 | 508 | |
| 509 | 509 | $val = $this->attributeValue(); |
| 510 | - if ($isValidAttribute) { | |
| 510 | + if ($isValidAttribute && !array_key_exists($name, $attributes)) { | |
| 511 | 511 | $attributes[$name] = $val; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | return true; |
| @@ -728,8 +728,9 @@ | ||
| 728 | 728 | } |
| 729 | 729 | // Test for '!>' |
| 730 | 730 | if ('!' == $this->scanner->current() && '>' == $this->scanner->peek()) { |
| 731 | 731 | $this->scanner->consume(); // Consume the last '>' |
| 732 | + | |
| 732 | 733 | return true; |
| 733 | 734 | } |
| 734 | 735 | // Unread '-' and one of '!' or '>'; |
| 735 | 736 | $this->scanner->unconsume(2); |
| @@ -1126,9 +1127,9 @@ | ||
| 1126 | 1127 | |
| 1127 | 1128 | return '&'; |
| 1128 | 1129 | } |
| 1129 | 1130 | |
| 1130 | - // Hexidecimal encoding. | |
| 1131 | + // Hexadecimal encoding. | |
| 1131 | 1132 | // X[0-9a-fA-F]+; |
| 1132 | 1133 | // x[0-9a-fA-F]+; |
| 1133 | 1134 | if ('x' === $tok || 'X' === $tok) { |
| 1134 | 1135 | $tok = $this->scanner->next(); // Consume x |
| @@ -1206,8 +1207,12 @@ | ||
| 1206 | 1207 | * @return bool True if it is a letter, False otherwise |
| 1207 | 1208 | */ |
| 1208 | 1209 | protected function is_alpha($input) |
| 1209 | 1210 | { |
| 1211 | + if (!is_string($input) || 1 !== strlen($input)) { | |
| 1212 | + return false; | |
| 1213 | + } | |
| 1214 | + | |
| 1210 | 1215 | $code = ord($input); |
| 1211 | 1216 | |
| 1212 | 1217 | return ($code >= 97 && $code <= 122) || ($code >= 65 && $code <= 90); |
| 1213 | 1218 | } |