summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2015-02-18 13:59:32 +0100
committerMichael Wallner <mike@php.net>2015-02-18 13:59:32 +0100
commit0d2a2b98c9e88e63e6a3496d6dbf2cc479684427 (patch)
treef8143b332191b1bdd9fee06e5803752434969fa5
parentf977a9f2be5a587dc0dbbd538b5b29396e5dd597 (diff)
parent225af964c0324b2bf14e44c0fad77198b97cc06c (diff)
downloadphp-git-0d2a2b98c9e88e63e6a3496d6dbf2cc479684427.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fixed bug #65593 (Segfault when calling ob_start from output buffering callback)
-rw-r--r--main/output.c23
-rw-r--r--tests/output/bug65593.phpt13
2 files changed, 25 insertions, 11 deletions
diff --git a/main/output.c b/main/output.c
index d0cdb13fec..456241f4e9 100644
--- a/main/output.c
+++ b/main/output.c
@@ -172,21 +172,22 @@ PHPAPI void php_output_deactivate(TSRMLS_D)
{
php_output_handler **handler = NULL;
- php_output_header(TSRMLS_C);
+ if ((OG(flags) & PHP_OUTPUT_ACTIVATED)) {
+ php_output_header(TSRMLS_C);
- 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 (SUCCESS == zend_stack_top(&OG(handlers), (void *) &handler)) {
- php_output_handler_free(handler TSRMLS_CC);
- zend_stack_del_top(&OG(handlers));
+ /* release all output handlers */
+ if (OG(handlers).elements) {
+ while (SUCCESS == zend_stack_top(&OG(handlers), (void *) &handler)) {
+ php_output_handler_free(handler TSRMLS_CC);
+ zend_stack_del_top(&OG(handlers));
+ }
+ zend_stack_destroy(&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