Edit report at http://bugs.php.net/bug.php?id=17461&edit=1

 ID:               17461
 Comment by:       xxleite at gmail dot com
 Reported by:      jason at thinkingman dot org
 Summary:          register_shutdown_function() timeout problem
 Status:           Bogus
 Type:             Bug
 Package:          Scripting Engine problem
 Operating System: Windows 2000 SP2
 PHP Version:      4.2.1

 New Comment:

i try to play with all, but i got the same error...



set_time_limit doesnt works well with register_shutdown_function, please
fix it 

for our php pride! ...



thanks anyway.


Previous Comments:
------------------------------------------------------------------------
[2002-12-08 10:44:02] sni...@php.net

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.



Please add possible additional information here:



  http://bugs.php.net/bug.php?id=14542



(no need for many reports about same issue)



------------------------------------------------------------------------
[2002-09-17 11:51:55] jason at thinkingman dot org

I posted the following response in php.general and php.windows --
responding to users whom looked at the online help file for
REGISTER_SHUTDOWN_FUNCTION() on php.net and inquired whether this
TIMEOUT was actually a bug or a feature request:

----------------------------------------------

It's a bug.  spoke to Rasmus at some length about just before i posted
it in the bug report.



The online help page is inaccurate in describing the full functionality
of the function:
http://www.php.net/manual/en/function.register-shutdown-function.php



REGISTER_SHUTDOWN_FUNCTION() is suppose to kick-off when any one of the
following things happen -- Exit, Error, TIMEOUT or User Abort.



According to Rasmus, the TIMEOUT functionality of this function works
fine under Linux -- however, it's not working under Win32 !



There apparently is another bug with this function -- you are suppose to
be able to call more than one REGISTER_SHUTDOWN_FUNCTION(), and they are
suppose to executed in-order... some people are reporting that only the
first encountered REGISTER_SHUTDOWN_FUNCTION() is executed, then the
script exits.



Someone needs to go through this function, pretty thoroughly, and get it
working correctly.  Being able to run code on a timeout, user-abort or
error is critical.



Jason

------------------------------------------------------------------------
[2002-05-27 14:11:04] jason at thinkingman dot org

REGISTER_SHUTDOWN_FUNCTION() doesn't work on TIMEOUT for the Win32
platform.



I've tried this under PHP versions 4.1.1 and 4.2.1 -- same thing
happens.  Here's a sample script:



1: ?>

2:

3: set_time_limit(1);

4:

5: function clean_up()

6: {

7:  print("Script Terminated\n");

8: }

9: 

10: register_shutdown_function("clean_up");

11:

12: while(1);

13:

14: ?>



Here's the error:

-----------------

Fatal error: Maximum execution time of 1 second exceeded in
C:\timeout_code.php on line 7



When this script TIMES-OUT, the REGISTER_SHUTDOWN_FUNCTION() will
"attempt" to run the function "clean_up" but will *immediately* generate
the error above in the 1st line (line 7, in this case) of the "clean_up"
function -- no matter what it is, and then the script terminates.



Now -- if I use the REGISTER_SHUTDOWN_FUNCTION() with an EXIT (instead
of a TIMEOUT), the function works fine... it *just* seems to be a
TIMEOUT issue.



The REGISTER_SHUTDOWN_FUNCTION() needs to ignore the TIMEOUT (timer??)
-- and proceed to run any code it's programmed to run.



Just a Note: I understand that PRINT() and a few other functions will
not work when a REGISTER_SHUTDOWN_FUNCTION() is called and *run*
SERVER-SIDE -- however, I am running this script from the COMMAND-LINE
and PRINT() does work here, even with a REGISTER_SHUTDOWN_FUNCTION() --
so PRINT() isn't the problem... Just for giggles, I've replaced the
PRINT() function with an ERRORLOG() function, in an attempt to write the
output to disk -- SAME ERROR and exits on line 7 -- never executing the
code.



Thanks

Jason Caldwell

ja...@thinkingman.org





------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=17461&edit=1

Reply via email to