diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1ae2ed5..c8ecc18 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,6 +23,7 @@ jobs: - "8.2" - "8.3" - "8.4" + - "8.5" steps: - name: Checkout code diff --git a/composer.json b/composer.json index 35b4a57..0b086fc 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "php" : ">=5.3.0" }, "require-dev": { - "phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" + "phpunit/phpunit" : "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9 || ^10" }, "autoload": { "psr-4": {"Masterminds\\": "src"} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8e7750d..930bacd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,10 @@ - + test/HTML5/ diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php index 77e268f..653903c 100644 --- a/src/HTML5/Parser/Tokenizer.php +++ b/src/HTML5/Parser/Tokenizer.php @@ -1208,6 +1208,10 @@ protected function decodeCharacterReference($inAttribute = false) */ protected function is_alpha($input) { + if (!is_string($input) || 1 !== strlen($input)) { + return false; + } + $code = ord($input); return ($code >= 97 && $code <= 122) || ($code >= 65 && $code <= 90); diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php index 7c2f485..526095b 100644 --- a/test/HTML5/Html5Test.php +++ b/test/HTML5/Html5Test.php @@ -560,4 +560,12 @@ public function testAnchorTargetQueryParam() $this->assertContains('https://domain.com/page.php?foo=bar&target=baz', $res); } } + + public function testEndsWithSlash() + { + $html = '

Visit example.comVisit example.com

'; + $doc = $this->html5->loadHTMLFragment($html); + $this->assertSame($expected, $this->html5->saveHTML($doc)); + } }