summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2015-02-18 14:04:19 +0100
committerMichael Wallner <mike@php.net>2015-02-18 14:04:19 +0100
commitb36581aa75ef671b53189bc05fbf791d0e437253 (patch)
treeca2cd9899de30fbb9aef8717b1a33fb4c23f2caf
parent86ba1073600530e728361483ee6e3138109c83dd (diff)
parent0d2a2b98c9e88e63e6a3496d6dbf2cc479684427 (diff)
downloadphp-git-b36581aa75ef671b53189bc05fbf791d0e437253.tar.gz
Merge branch 'PHP-5.6'
* PHP-5.6: Fixed bug #65593 (Segfault when calling ob_start from output buffering callback)
-rw-r--r--main/output.c20
-rw-r--r--tests/output/bug65593.phpt13
2 files changed, 23 insertions, 10 deletions
diff --git a/main/output.c b/main/output.c
index 2991d0dba1..64729ac4a4 100644
--- a/main/output.c
+++ b/main/output.c
@@ -179,21 +179,21 @@ PHPAPI void php_output_deactivate(void)
{
php_output_handler **handler = NULL;
- php_output_header();
+ if ((OG(flags) & PHP_OUTPUT_ACTIVATED)) {
- OG(flags) ^= PHP_OUTPUT_ACTIVATED;
- OG(active) = NULL;
- OG(running) = NULL;
+ OG(flags) ^= PHP_OUTPUT_ACTIVATED;
+ OG(active) = NULL;
+ OG(running) = NULL;
- /* release all output handlers */
- if (OG(handlers).elements) {
- while ((handler = zend_stack_top(&OG(handlers)))) {
- php_output_handler_free(handler);
- zend_stack_del_top(&OG(handlers));
+ /* release all output handlers */
+ if (OG(handlers).elements) {
+ while ((handler = zend_stack_top(&OG(handlers)))) {
+ php_output_handler_free(handler);
+ zend_stack_del_top(&OG(handlers));
+ }
}
zend_stack_destroy(&OG(handlers));
}
-
}
/* }}} */
diff --git a/tests/output/bug65593.phpt b/tests/output/bug65593.phpt
new file mode 100644
index 0000000000..336c73e03d
--- /dev/null
+++ b/tests/output/bug65593.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #65593 (ob_start(function(){ob_start();});)
+--FILE--
+<?php
+echo "Test\n";
+
+ob_start(function(){ob_start();});
+?>
+===DONE===
+--EXPECT--
+Test
+
+Fatal error: Cannot destroy active lambda function in /home/mike/src/php-5.5/tests/output/bug65593.php on line 4