com php-src: Fixed bug #65593 (Segfault when calling ob_start from output buffering callback): NEWS main/output.c tests/output/bug65593.phpt

From: Date: Wed, 18 Feb 2015 12:58:31 +0000
Subject: com php-src: Fixed bug #65593 (Segfault when calling ob_start from output buffering callback): NEWS main/output.c tests/output/bug65593.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84988@lists.php.net to get a copy of this message
Commit: 225af964c0324b2bf14e44c0fad77198b97cc06c Author: Michael Wallner <mike@php.net> Wed, 18 Feb 2015 13:58:31 +0100 Parents: 73c2e9153a7bee878c4d57d3dbc439edcd717ce9 Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=225af964c0324b2bf14e44c0fad77198b97cc06c Log: Fixed bug #65593 (Segfault when calling ob_start from output buffering callback) Bugs: https://bugs.php.net/65593 Changed paths: M NEWS M main/output.c A tests/output/bug65593.phpt Diff: diff --git a/NEWS b/NEWS index 079e077..5004990 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2015, PHP 5.5.23 - Core: + . Fixed bug #65593 (Segfault when calling ob_start from output buffering + callback). (Mike) . Fixed bug #69017 (Fail to push to the empty array with the constant value defined in class scope). (Laruence) . Added NULL byte protection to exec, system and passthru. (Yasuo) diff --git a/main/output..c b/main/output.c index f9b8a68..bb0f6bd 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 0000000..336c73e --- /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

« previous php.cvs (#84988) next »