It doesn't matter.  I'm setting the output *not* to the browser, but to the
command shell, where I am running the script from.  If you look at the
errors, you'll see 2 of them, one points to line 7, where the IF() command
is -- the script terminates there...

I've put error_log() and exec() functions in place of the print()
function -- it doesn't make a difference -- the script just won't execute
the function in the register_shutdown_function() --

The following script works great (see below) -- it seems that for some
reason its a TIMEOUT issue (bug).

Running the script below, I will get the output of the print() function --
as stated, from the command line.  I understand that it wouldn't show up in
the browser.

If I replace the "exit;" command with say a "while(1);" where the script
will loop indefinitely, the timeout, set by the set_time_limit(1) will stop
the script, but again -- register_shutdown_function() seems to "want to
work" as the function IS CALLED, but NEVER executed, and instead errors on
the 1st line in the FUNCTION -- always on a TIMEOUT.

Run this script from your command line (ie. C:>php test.php) -- then change
the "set_time_limit(30)" to "set_time_limit(1)", and replace the "exit" with
a "while(1)" -- run the script again, you'll see what I mean.

And, if you still don't believe me, replace the print() in the function with
"error_log('Script Terminated', 3, 'errorlog.txt');" and see if the
"errorlog.txt" file is ever created -- it isn't.

<?
set_time_limit(30);
 function clean_up()
 {
  print("Script Terminated");
 }
register_shutdown_function("clean_up");
 exit;
?>

If anyone can offer any reason why its doing this, please help -- thanks.

Jason




"Cc Zona" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> In article <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] (Jason Caldwell) wrote:
>
> > Here's my code:
> > ----------------
> > <?
> >  set_time_limit(1);
> >  function clean_up()
> >  {
> >   if(connection_status() & TIMEOUT)
> >    print("Script timed out.\n");
> >  }
> > register_shutdown_function("clean_up");
> > while(1);
> > ?>
> >
> > Here's the message I get:  (I should get "Script timed out.")
>
> No, you shouldn't/wouldn't, because--as is noted in the docs
> <http://php.net/register-shutdown-function>--no more output ("print" is
> specifically mentioned as an example) can be sent to the browser at that
> stage.  Try sending youself an email, or logging to a file instead.
>
> --
> CC



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to