]> granicus.if.org Git - php/commitdiff
Fix #77594: ob_tidyhandler is never reset
authorChristoph M. Becker <cmbecker69@gmx.de>
Sat, 14 Nov 2020 14:03:58 +0000 (15:03 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sun, 22 Nov 2020 13:02:29 +0000 (14:02 +0100)
We reset to original INI value on request shutdown.

Closes GH-6425.

NEWS
ext/tidy/tests/bug77594.phpt [new file with mode: 0644]
ext/tidy/tidy.c

diff --git a/NEWS b/NEWS
index 229c459bcadaa7f475d964a9c204065c7dc1f89e..5af2ed8741acbf92a79a061ea8686fad45baf4bd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ PHP                                                                        NEWS
     (cmb)
   . Fixed bug #72964 (White space not unfolded for CC/Bcc headers). (cmb)
 
+- Tidy:
+  . Fixed bug #77594 (ob_tidyhandler is never reset). (cmb)
+
 26 Nov 2020, PHP 7.4.13
 
 - Core:
diff --git a/ext/tidy/tests/bug77594.phpt b/ext/tidy/tests/bug77594.phpt
new file mode 100644 (file)
index 0000000..0d84a03
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Bug #77594 (ob_tidyhandler is never reset)
+--DESCRIPTION--
+Test is useful only with --repeat 2 (or more)
+--SKIPIF--
+<?php
+if (!extension_loaded('tidy')) die('skip tidy extension not available');
+?>
+--FILE--
+<?php
+ob_start('ob_tidyhandler');
+var_dump(ob_end_clean());
+?>
+--EXPECT--
+bool(true)
index a1a5184dd5dd2738f8d8d9e7d8541e2d8d7c6424..266e6510efbf1be954ea5dab5f5aa691881f5222 100644 (file)
@@ -240,6 +240,7 @@ static int php_tidy_output_handler(void **nothing, php_output_context *output_co
 static PHP_MINIT_FUNCTION(tidy);
 static PHP_MSHUTDOWN_FUNCTION(tidy);
 static PHP_RINIT_FUNCTION(tidy);
+static PHP_RSHUTDOWN_FUNCTION(tidy);
 static PHP_MINFO_FUNCTION(tidy);
 
 static PHP_FUNCTION(tidy_getopt);
@@ -500,7 +501,7 @@ zend_module_entry tidy_module_entry = {
        PHP_MINIT(tidy),
        PHP_MSHUTDOWN(tidy),
        PHP_RINIT(tidy),
-       NULL,
+       PHP_RSHUTDOWN(tidy),
        PHP_MINFO(tidy),
        PHP_TIDY_VERSION,
        PHP_MODULE_GLOBALS(tidy),
@@ -1106,6 +1107,13 @@ static PHP_RINIT_FUNCTION(tidy)
        return SUCCESS;
 }
 
+static PHP_RSHUTDOWN_FUNCTION(tidy)
+{
+       TG(clean_output) = INI_ORIG_BOOL("tidy.clean_output");
+
+       return SUCCESS;
+}
+
 static PHP_MSHUTDOWN_FUNCTION(tidy)
 {
        UNREGISTER_INI_ENTRIES();