Skip to content

Commit 55aa4ec

Browse files
committed
Fixed an issue with no value attributes
1 parent 968f04a commit 55aa4ec

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/PHPHtmlParser/Dom/Tag.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,14 @@ public function noise($noise)
9898
*/
9999
public function setAttribute($key, $value)
100100
{
101-
// convert charset
102-
$encode = new Encode;
103-
$encode->from(Dom::$expectedCharset);
104-
$encode->to(Dom::$charset);
105-
$value['value'] = $encode->convert($value['value']);
101+
if (is_string($value['value']))
102+
{
103+
// convert charset
104+
$encode = new Encode;
105+
$encode->from(Dom::$expectedCharset);
106+
$encode->to(Dom::$charset);
107+
$value['value'] = $encode->convert($value['value']);
108+
}
106109

107110
$this->attr[$key] = $value;
108111
return $this;

0 commit comments

Comments
 (0)