php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39629 Buffer clean in error handler causes PHP crash
Submitted: 2006-11-25 19:32 UTC Modified: 2006-11-30 08:23 UTC
From: robert dot tuley at imperial dot ac dot uk Assigned:
Status: Closed Package: Output Control
PHP Version: 5.2.0 OS: winXP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
6 + 45 = ?
Subscribe to this entry?

 
 [2006-11-25 19:32 UTC] robert dot tuley at imperial dot ac dot uk
Description:
------------
Trying to clean the buffer in a custom error handler causes script exit when that buffer has 'ob_gzhandler' as a handler. The behaviour is consistent for both PHP5 and PHP4. Note that the example works correctly if there is no callback function specified in the call to ob_start(). 

Reproduce code:
---------------
// set error handler
function errorHandler($code,$string,$filename,$line,$scope) {
    ob_end_clean();
    die('should reach here');
}
set_error_handler('errorHandler');

// use ob_gzhandler to buffer page
ob_start('ob_gzhandler');
echo 'some output';
trigger_error('encounters error',E_USER_ERROR);

Expected result:
----------------
should reach here

Actual result:
--------------
No output.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-27 10:08 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Cannot reproduce.
I get no crash, but the expected result instead.
 [2006-11-30 08:23 UTC] robert dot tuley at imperial dot ac dot uk
Apologies, on closer inspection this seems not to be a problem with PHP, as it produces the expected results when run from the command line.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC