Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
7 changes: 6 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="vendor/autoload.php">
<phpunit
colors="true"
bootstrap="vendor/autoload.php"
failOnDeprecation="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
>
<testsuites>
<testsuite name="PHPUnit">
<directory>test/HTML5/</directory>
Expand Down
4 changes: 4 additions & 0 deletions src/HTML5/Parser/Tokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions test/HTML5/Html5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,4 +560,12 @@ public function testAnchorTargetQueryParam()
$this->assertContains('<a href="https://domain.com/page.php?foo=bar&amp;target=baz">https://domain.com/page.php?foo=bar&amp;target=baz</a>', $res);
}
}

public function testEndsWithSlash()
{
$html = '<p>Visit <a href="http://example.com/">example.com</';
$expected = '<p>Visit <a href="http://example.com/">example.com</a></p>';
$doc = $this->html5->loadHTMLFragment($html);
$this->assertSame($expected, $this->html5->saveHTML($doc));
}
}