Skip to content

Commit 1062091

Browse files
author
Hexydec
committed
Fixed bug in htmldoc::open() where the charset could end up being set to false, which then caused the load() method to fail.
Fixed issue in tag::html() where the attribute value can be null, but it wasn't converted to a string for a string operation. Updated dependencies.
1 parent 874787b commit 1062091

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/htmldoc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ public function open(string $url, $context = null, string &$error = null) {
191191
$meta = stream_get_meta_data($handle);
192192
if (!empty($meta['wrapper_data'])) {
193193
foreach ($meta['wrapper_data'] AS $item) {
194-
if (mb_stripos($item, 'Content-Type:') === 0 && ($charset = mb_stristr($item, 'charset=')) !== false) {
195-
$charset = mb_substr($charset, 8);
194+
if (mb_stripos($item, 'Content-Type:') === 0 && ($value = mb_stristr($item, 'charset=')) !== false) {
195+
$charset = mb_substr($value, 8);
196196
break;
197197
}
198198
}

src/tokens/tag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ public function html(array $options = []) : string {
653653

654654
// double quotes
655655
} else {
656-
$html .= '="'.str_replace(['&', '"', '<'], ['&amp;', '&quot;', '&lt;'], $value).'"';
656+
$html .= '="'.str_replace(['&', '"', '<'], ['&amp;', '&quot;', '&lt;'], strval($value)).'"';
657657
}
658658
}
659659
}

0 commit comments

Comments
 (0)