Re: Re: cvs: php4 /main output.c
| From: | Derick Rethans | Date: | Thu, 03 Oct 2002 07:39:36 +0000 |
| Subject: | Re: Re: cvs: php4 /main output.c | ||
| References: | 1 2 3 4 5 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-88930@lists.php.net to get a copy of this message | ||
On Thu, 3 Oct 2002, Yasuo Ohgaki wrote:
> You are the one used unexported php_ob_* function in var.c :)
> I'll fix var.c, then.
No, don't. These functions were meant to be exported, see this chat log
with Zeev from around the time I implemented the function:
php.bugs-2001-12-15:
15:03 <@Derick> lets see if I can fix var_export
15:03 <@Zeev> what are you guys working on
15:03 <@Zeev> SRM?
15:03 <@Derick> making var_export not output to STDOUT, but return the data in a var
15:03 <@Derick> and this has nothing to do with SRM :)
15:03 <@Zeev> what's var_Export?
15:03 <@Zeev> and why not use output buffering/
15:03 <@Markus> hehe!!!
15:04 <@Derick> var_dump, but than real PHP code
15:04 <@Zeev> just use output buffering
15:04 <@Derick> yeah, that's hacky
15:04 <@Zeev> you can even use it internally
15:04 <@Zeev> no it's not
15:04 <@Markus> zeev: its really ... annoying to use ob_start(); var_dump($foo); $blaat =
ob_get_contents() ...
15:04 <@Derick> Zeev: tell me how then :)
15:04 <@Zeev> writing specific support for every function is hacky
15:04 <@Zeev> output buffering does exactly this :)
15:04 <@Zeev> well
15:05 <@Derick> or do you have any good example?
15:05 <@Markus> damn var_dump() hasn't returned the content since the beginning as a
return value
15:05 <@Zeev> php_start_ob_buffer(NULL, 0);
15:05 <@Zeev> do all the printing
15:05 <@Zeev> and then php_ob_get_buffer(&zval)
15:05 <@Zeev> and then php_end_ob_buffer(0, 0);
15:05 <@Derick> that's all?
15:05 <@Zeev> yeah
15:05 <@Derick> oh, let me check
15:11 <@Markus> opensrc you lazy boy :) http://lxr.php.net/source/php4/main/output.c#391
15:12 <@Derick> mmm?
15:12 <@Zeev> opensrc yes
15:50 <@Zeev> it worked?
15:50 <@Derick> yeah
15:50 <@Derick> I think so :)
15:51 <@Zeev> cool
15:51 <@Derick> I don't like testing :)
15:51 <@Zeev> it's the first time it's been done I think :)
15:51 <@Derick> hehe
15:51 <@Zeev> you're missing TSRMLS's there :)
15:51 <@Derick> I'll add something to the api docs then
15:51 <@Derick> Zeev: where? you didn't tell me about that :)
15:51 <@Zeev> you just copy&pasted eh? :)
15:51 <@Derick> sure
15:51 <@Derick> :)
15:52 <@Zeev> all of them take TSRMLS_CC
15:52 <@Derick> ok
15:52 <@Derick> but it did compile fine for me
15:52 <@Derick> php_ob_get_buffer (return_value TSRMLS_CC);
15:52 <@Derick> php_end_ob_buffer (0, 0 TSRMLS_CC);
15:52 <@Derick> that better?
15:53 <@Zeev> you need it in start_ob_buffer too
15:53 <@Derick> mmm
15:53 <@Zeev> but yeah it's good
Derick
> Derick Rethans wrote:
> > On Thu, 3 Oct 2002, Yasuo Ohgaki wrote:
> >
> >
> >>A little history. When 4.1.0 (or 4.2.0?) is released, I've fixed
> >>crush with deleting wrong buffer with implicit flush. The fix
> >>disabled implicit flush.
> >>
> >>I finally fixed implicit flush. Users should worry about
> >>implicit flush directive in php.ini now. e.g. implicit_flush=Off
> >>for normal use.
> >>
> >>Apparently, CLI SAPI implicitly enable implicit flush at
> >>initialization no matter what the php.ini setting is. CLI behavior
> >>is wrong, since there is no way to change implicit flush directive
> >>once script is started. I notified this to Edin and he would address
> >>this issue soon hopefully.
> >
> >
> > Can be, but implicit_flush is documented like this (which is correct):
> >
> > implicit_flush boolean
> >
> > FALSE by default. Changing this to TRUE tells PHP to tell the output
> > layer to flush itself automatically after every output block. This is
> > equivalent to calling the PHP function flush() after each and every call
> > to print() or echo() and each and every HTML block.
> >
> > It says totally NOTHING about output buffering issues. This change also
> > breaks internal functions:
> >
> > <?php
> > $str = var_export ("foo", TRUE);
> > ?>
> > 'foo'
> >
> > (While it should not have dumped the contents at all). Please revert
> > this, as this breaks backward compability BIG time, and IMO this is not
> > a shortcoming of CLI. BTW, where did you get that implicit_flush should
> > disable all output buffers?
> >
> > Derick
> >
> > --
> >
> > ---------------------------------------------------------------------------
> > Derick Rethans
> > http://derickrethans.nl/
> > JDI Media Solutions
> > --------------[ if you hold a unix shell to your ear, do you hear the c? ]-
> >
>
>
--
---------------------------------------------------------------------------
Derick Rethans http://derickrethans.nl/
JDI Media Solutions
--------------[ if you hold a unix shell to your ear, do you hear the c? ]-