php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16673 callback registered via ob_start is called when not expected
Submitted: 2002-04-17 18:58 UTC Modified: 2002-10-19 01:00 UTC
From: bob at mroczka dot com Assigned:
Status: No Feedback Package: Output Control
PHP Version: 4.2.0 OS: linux 2.4.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bob at mroczka dot com
New email:
PHP Version: OS:

 

 [2002-04-17 18:58 UTC] bob at mroczka dot com
i have the following code where ... represents some
echo statements but does not include any ob_xxx calls.

ob_start("func");
...
ob_end_clean();

and func is defined as:

function func ($buf) {
  error_log("got here",0);
  return $buf;
}

when this code runs i get "got here" in my error log.
i am expecting the ob_end_clean call to turn off output
buffering which includes not calling the callback I 
registered.  i am using 4.2.0rc2 currently.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-03 23:13 UTC] yohgaki@php.net
I guess you have some ob_flush() functions, don't you?
 [2002-05-06 17:53 UTC] bob at mroczka dot com
with the ob_end_clean call in my code my intention is to discard the buffer and disable output buffering.  i do not have any ob_flush calls in my code.

here is some background on what i'm trying to do.  in a nutshell i have a call in my code (dio_fcntl) which attempts to get an exclusive lock on a file.  in theory this call can block forever (or until the script execution timeout occurs).  to alert the user that a timeout occurred while waiting on the lock i create a buffer with an error message just before the call to the code that may block.  if the script gets the lock before a timeout occurs i call ob_end_clean() to release the error message in the buffer which is not needed.  if a timeout occurs php flushes this buffer containing the error message and the user is notified of the error.  

the purpose of registering a callback in my case is not to modify the output buffer (the error message) but to put a message in the web server error log that this problem occurred.  i was expecting the callback function to not get called when ob_end_clean() is executed.  in theory the callback should only be called in my case if the script execution timer expires.
some code which can block
 [2002-09-30 22:09 UTC] yohgaki@php.net
Please try using this CVS snapshot:

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


 [2002-10-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 16:01:29 2024 UTC