Edit report at https://bugs.php.net/bug.php?id=61541&edit=1

 ID:                 61541
 Updated by:         yohg...@php.net
 Reported by:        grzegorz129 at gmail dot com
 Summary:            Segfault using ob_clean/flush* functions in
                     output_callback function
 Status:             Open
 Type:               Bug
 Package:            Reproducible crash
-Operating System:   Linux/debian lenny
+Operating System:   ANY
 PHP Version:        5.3/5.4/5.5-dev
 Block user comment: N
 Private report:     N

 New Comment:

--------
[yohgaki@dev php-src]$ cat t.php 
<?php
 ob_start('foo');
  function foo() { ob_end_clean(); }
  ?>
-------

This kind of code worked since the output buffer was introduced. i.e. Works 
from 
PHP 4.0.

It seems PHP5.4+ has newer API, but it just raise fatal error.
I was surprised now it's not working, so I'll fix this.

-------
[yohgaki@dev php-src]$ php -v
PHP 5.4.1RC1-dev (cli) (built: Mar 22 2012 17:06:46) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
[yohgaki@dev php-src]$ php t.php

Fatal error: ob_end_clean(): Cannot use output buffering in output buffering 
display handlers in /home/yohgaki/ext/git/oss/php.net/php-src/t.php on line 3
-------


Previous Comments:
------------------------------------------------------------------------
[2012-03-28 18:43:17] m...@php.net

Why has the PHP version of the report been changed?

This code works fine in PHP-5.4+

------------------------------------------------------------------------
[2012-03-28 18:28:51] yohg...@php.net

This should work. Assign to myself.

------------------------------------------------------------------------
[2012-03-28 17:49:00] grzegorz129 at gmail dot com

@reeze - thanks for patch & title suggestion.
Is there any way to catch E_PARSE? As you can see ob_* is dead end ;)

------------------------------------------------------------------------
[2012-03-28 16:42:41] reeze dot xia at gmail dot com

@grzegorz129 maybe the title can be more specific: eg: Segfault using 
ob_clean/flush* functions in output_callback function

------------------------------------------------------------------------
[2012-03-28 16:40:46] reeze dot xia at gmail dot com

I've sent a pull request to fix this. @see 
https://github.com/php/php-src/pull/25
this makes php raise fatal error instead of segfault.

This seems to be a logic error when clean/flush output will cause the callback 
called and then endless function call.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=61541


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61541&edit=1

Reply via email to