diff --git a/ext/tidy/tests/gh12980.phpt b/ext/tidy/tests/gh12980.phpt
new file mode 100644
index 0000000000000..042701388a4e5
--- /dev/null
+++ b/ext/tidy/tests/gh12980.phpt
@@ -0,0 +1,34 @@
+--TEST--
+GH-12980 (tidynode.props.attribute is missing "Boolean Attributes" and empty attributes)
+--EXTENSIONS--
+tidy
+--FILE--
+';
+
+$tidy = new tidy();
+$tidy->ParseString($html);
+echo tidy_get_output($tidy), "\n";
+
+var_dump($tidy->root()->child[1]->attribute);
+
+?>
+--EXPECT--
+
+
+
+
+
+
+
+
+array(4) {
+ ["lang"]=>
+ string(2) "en"
+ ["boolean"]=>
+ string(0) ""
+ ["empty"]=>
+ string(0) ""
+ ["selected"]=>
+ string(8) "selected"
+}
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index e7b345dd25e34..a2e4dec90a3e1 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -662,8 +662,12 @@ static void tidy_add_node_default_properties(PHPTidyObj *obj)
do {
name = (char *)tidyAttrName(tempattr);
val = (char *)tidyAttrValue(tempattr);
- if (name && val) {
- add_assoc_string(&attribute, name, val);
+ if (name) {
+ if (val) {
+ add_assoc_string(&attribute, name, val);
+ } else {
+ add_assoc_str(&attribute, name, zend_empty_string);
+ }
}
} while((tempattr = tidyAttrNext(tempattr)));
} else {