|
Posted by Rik Wasmus on 11/21/07 21:07
On Wed, 21 Nov 2007 21:57:27 +0100, <jools@by.com> wrote:
> I'm having trouble modifying some code written by someone else.
> The code is very dense and obscure but does work fine. However I need to
> insert a block of my own and I've hit what I assume is a buffering
> problem.(If there's another answer I'd be grateful ...)
>
> The problem is PHP is refusing to do things in the correct sequence.
>
> I've tried all the variations of flushing I can think of without success.
>
> Can anyone suggest how I can force PHP to do this task in the correct
> sequence please?
>
> Thanks
> -jools-
>
> Using PHP 5.1
> Centos Linux V4
> Apache 2 server
>
> I need to do this:
> ------------------
>
> 1. I create a text file on the fly inside a folder
> 2. I output some lines from that text file -(May include some HTML such
> as a form but is not activated/posted) using echo or print
> 3. I delete the text file from the drive
>
> The sequence that occurs however is not 1 2 3
> but 1 3 2
> And I get an error because the file can't be found by event 2
>
> OK I thought - I remember something about ob_flush so I tried
This has nothing to do with output buffering. Everything you echo/print
will either be send directly or keep hanging in a buffer, totally
unrelated to the text file. If you've send them (to the buffer), there's
no way deleting the file can alter anything. If it's a buffer of PHP
itself, and that buffer gets flushed/deleted it's another thing.
So, your problem remains: why is is 1,3,2 and not 1,2,3? Impossible to
tell without any code. You could use some debugging/profiling pacckages to
help you find the 'real' flow through the code, or try to copy the
codebase to another location, and trim it rigurously down untill you have
a minimal code example with the mentioned unexpected behaviour.
--
Rik Wasmus
Navigation:
[Reply to this message]
|