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 @@ -57,6 +57,10 @@ PHP NEWS
5757 . Fixed bug GH-12929 (SimpleXMLElement with stream_wrapper_register can
5858 segfault). (nielsdos)
5959
60+ - Tidy:
61+ . Fixed bug GH-12980 (tidynode.props.attribute is missing
62+ "Boolean Attributes" and empty attributes). (nielsdos)
63+
606407 Dec 2023, PHP 8.3.1RC1
6165
6266- 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