Skip to content

Commit 9b1c02c

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #77594: ob_tidyhandler is never reset
2 parents 40ebfd6 + 221345a commit 9b1c02c

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ PHP NEWS
77
(cmb)
88
. Fixed bug #72964 (White space not unfolded for CC/Bcc headers). (cmb)
99

10+
- Tidy:
11+
. Fixed bug #77594 (ob_tidyhandler is never reset). (cmb)
12+
1013
26 Nov 2020, PHP 8.0.0
1114

1215
- BZ2:

ext/tidy/tests/bug77594.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #77594 (ob_tidyhandler is never reset)
3+
--DESCRIPTION--
4+
Test is useful only with --repeat 2 (or more)
5+
--SKIPIF--
6+
<?php
7+
if (!extension_loaded('tidy')) die('skip tidy extension not available');
8+
?>
9+
--FILE--
10+
<?php
11+
ob_start('ob_tidyhandler');
12+
var_dump(ob_end_clean());
13+
?>
14+
--EXPECT--
15+
bool(true)

ext/tidy/tidy.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ static int php_tidy_output_handler(void **nothing, php_output_context *output_co
228228
static PHP_MINIT_FUNCTION(tidy);
229229
static PHP_MSHUTDOWN_FUNCTION(tidy);
230230
static PHP_RINIT_FUNCTION(tidy);
231+
static PHP_RSHUTDOWN_FUNCTION(tidy);
231232
static PHP_MINFO_FUNCTION(tidy);
232233

233234
ZEND_DECLARE_MODULE_GLOBALS(tidy)
@@ -249,7 +250,7 @@ zend_module_entry tidy_module_entry = {
249250
PHP_MINIT(tidy),
250251
PHP_MSHUTDOWN(tidy),
251252
PHP_RINIT(tidy),
252-
NULL,
253+
PHP_RSHUTDOWN(tidy),
253254
PHP_MINFO(tidy),
254255
PHP_TIDY_VERSION,
255256
PHP_MODULE_GLOBALS(tidy),
@@ -863,6 +864,13 @@ static PHP_RINIT_FUNCTION(tidy)
863864
return SUCCESS;
864865
}
865866

867+
static PHP_RSHUTDOWN_FUNCTION(tidy)
868+
{
869+
TG(clean_output) = INI_ORIG_BOOL("tidy.clean_output");
870+
871+
return SUCCESS;
872+
}
873+
866874
static PHP_MSHUTDOWN_FUNCTION(tidy)
867875
{
868876
UNREGISTER_INI_ENTRIES();

0 commit comments

Comments
 (0)