note 60108 deleted from function.register-shutdown-function by crell
| From: | crell@php.net | Date: | Wed, 30 Mar 2022 22:03:31 +0000 |
| Subject: | note 60108 deleted from function.register-shutdown-function by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217805@lists.php.net to get a copy of this message | ||
Note Submitter: sezer yalcin
----
re:codeslinger at compsalot dot com
fork() is actually creating 2 processes from one. So there is no surprise register_shutdown_function
will be executed per each process.
I think you have reported this as a bug and now in php 5.1.0 when you exit from child process, it
does not execute it. Well, what are you going to do if you have something to register for forked
process?
I hope php will be more stable near soon!
codeslinger at compsalot dot com
03-Feb-2005 09:22
Here is a nice little surprise to keep in mind...
If you register a shutdown function for your main program. And then you fork() a child.
Guess What?
When the child exits it will run the code that was intended for the main program. This can be a
really bad thing ;-)
Happily there is a simple work-around. All you need to do is to create a global variable such as:
$IamaChild = [TRUE | FALSE];
and have your shutdown function check the value...