From 8dff53fe8cfdc65a50649bc34d28b563da80c35f Mon Sep 17 00:00:00 2001 From: Matt3o12 Date: Sun, 1 Jun 2025 15:01:13 +0000 Subject: [PATCH] Fix null value assignment for tag attributes in getAttributes method --- src/PHPHtmlParser/Dom/Tag.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PHPHtmlParser/Dom/Tag.php b/src/PHPHtmlParser/Dom/Tag.php index 2aeb6aa8..35566b74 100644 --- a/src/PHPHtmlParser/Dom/Tag.php +++ b/src/PHPHtmlParser/Dom/Tag.php @@ -326,13 +326,13 @@ public function makeOpeningTag() foreach (\array_keys($this->attr) as $key) { try { $attributeDTO = $this->getAttribute($key); + $val = $attributeDTO->getValue(); } catch (AttributeNotFoundException $e) { // attribute that was in the array not found in the array... let's continue. continue; } catch (\TypeError $e) { - $val = null; + $val = null; } - $val = $attributeDTO->getValue(); if (\is_null($val)) { $return .= ' ' . $key; } elseif ($attributeDTO->isDoubleQuote()) {