Bug #17635 Updated: User-defined output handler can't find files without ob_end_flush()
| From: | mogul-php at gelatinous dot com | Date: | Fri, 07 Jun 2002 16:55:49 +0000 |
| Subject: | Bug #17635 Updated: User-defined output handler can't find files without ob_end_flush() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9779@lists.php.net to get a copy of this message | ||
ID: 17635
Updated by: mogul-php@gelatinous.com
Reported By: mogul-php@gelatinous.com
-Status: Feedback
+Status: Open
Bug Type: Output Control
Operating System: RH Linux 7.3 w/all updates
PHP Version: 4.2.1
New Comment:
Still building 4.3.0-dev... Meanwhile, I tried it via the CLI with
4.2.1 and this behavior is not exhibited! So it only appears when
called as a module from apache...
[apache version is 1.3.23.]
Previous Comments:
------------------------------------------------------------------------
[2002-06-07 12:13:55] derick@php.net
You can either use a snapshot from snaps.php.net (the non-STABLE
tarball) or get it from CVS (HEAD).
Derick
------------------------------------------------------------------------
[2002-06-07 12:03:55] mogul-php@gelatinous.com
Happy to try... How do I acquire 4.3.0-dev? Is this a tarball? CVS
branch? Or is this just shorthand for the HEAD branch in CVS?
------------------------------------------------------------------------
[2002-06-07 00:28:54] yohgaki@php.net
Cannot reproduce with PHP 4.3.0(CLI).
Could you try PHP 4.3.0-dev and report the result?
------------------------------------------------------------------------
[2002-06-07 00:17:15] mogul-php@gelatinous.com
I wrote a custom output handler and registered it with ob_start(). The
handler gets called if I call ob_end_flush() or when the script ends,
as expected.
If the handler tries to open a file that's in the same directory as the
script, I get different behavior depending on whether ob_end_flush()
was called or the script just ended. Here's code demonstrating the bug
(replace 'fileinthisdir' with an actual file's name):
<?php
$explicit_ob_flush=false;
function my_output_handler($string) {
return (fopen('fileinthisdir', 'r') ? "Opened file!" :
"Couldn't open
file!");
}
ob_start("my_output_handler");
?>
Hi, this is some text.
<?
if($explicit_ob_flush) {
ob_end_flush();
}
?>
This script won't find the file as is. Change $explicit_ob_flush to
true, though, and it will. (Note that supplying a full pathname to the
file works... This is a problem with relative paths, not absolute
paths.)
[I'm running RH 7.3 with all updates applied. My php is version 4.2.1
from the RH RawHide RPMs, recompiled to add --enable-xslt and
--with-xslt-sablot but otherwise unmodified. The sablotron version is
0.90.]
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17635&edit=1