File tree Expand file tree Collapse file tree 3 files changed +44
-2
lines changed
Expand file tree Collapse file tree 3 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ PHP NEWS
4646 . Fix getting the address of an uninitialized property of a SimpleXMLElement
4747 resulting in a crash. (nielsdos)
4848
49+ - Tidy:
50+ . Fixed bug GH-12980 (tidynode.props.attribute is missing
51+ "Boolean Attributes" and empty attributes). (nielsdos)
52+
495321 Dec 2023, PHP 8.2.14
5054
5155- Core:
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)
662662 do {
663663 name = (char * )tidyAttrName (tempattr );
664664 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+ }
667671 }
668672 } while ((tempattr = tidyAttrNext (tempattr )));
669673 } else {
You can’t perform that action at this time.
0 commit comments