File tree 2 files changed +40
-2
lines changed 2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-12980 (tidynode.props.attribute is missing "Boolean Attributes" and empty attributes)
3
+ --EXTENSIONS--
4
+ tidy
5
+ --FILE--
6
+ <?php
7
+ $ html = '<!DOCTYPE html><html lang="en" boolean empty="" selected="selected"></html> ' ;
8
+
9
+ $ tidy = new tidy ();
10
+ $ tidy ->ParseString ($ html );
11
+ echo tidy_get_output ($ tidy ), "\n" ;
12
+
13
+ var_dump ($ tidy ->root ()->child [1 ]->attribute );
14
+
15
+ ?>
16
+ --EXPECT--
17
+ <!DOCTYPE html>
18
+ <html lang="en" boolean="" empty="" selected="selected">
19
+ <head>
20
+ <title></title>
21
+ </head>
22
+ <body>
23
+ </body>
24
+ </html>
25
+ array(4) {
26
+ ["lang"]=>
27
+ string(2) "en"
28
+ ["boolean"]=>
29
+ string(0) ""
30
+ ["empty"]=>
31
+ string(0) ""
32
+ ["selected"]=>
33
+ string(8) "selected"
34
+ }
Original file line number Diff line number Diff line change @@ -662,8 +662,12 @@ static void tidy_add_node_default_properties(PHPTidyObj *obj)
662
662
do {
663
663
name = (char * )tidyAttrName (tempattr );
664
664
val = (char * )tidyAttrValue (tempattr );
665
- if (name && val ) {
666
- add_assoc_string (& attribute , name , val );
665
+ if (name ) {
666
+ if (val ) {
667
+ add_assoc_string (& attribute , name , val );
668
+ } else {
669
+ add_assoc_str (& attribute , name , zend_empty_string );
670
+ }
667
671
}
668
672
} while ((tempattr = tidyAttrNext (tempattr )));
669
673
} else {
You can’t perform that action at this time.
0 commit comments