Skip to content

Commit

Permalink
Merge branch 'PHP-5.6'
Browse files Browse the repository at this point in the history
* PHP-5.6:
  Fixed bug #65593 (Segfault when calling ob_start from output buffering callback)
  • Loading branch information
m6w6 committed Feb 18, 2015
2 parents 86ba107 + 0d2a2b9 commit b36581a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
20 changes: 10 additions & 10 deletions main/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

}
/* }}} */

Expand Down
13 changes: 13 additions & 0 deletions tests/output/bug65593.phpt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b36581a

Please sign in to comment.