note 49643 added to function.register-shutdown-function

From: Date: Thu, 03 Feb 2005 17:22:45 +0000
Subject: note 49643 added to function.register-shutdown-function
Groups: php.notes 
Request: Send a blank email to php-notes+get-84449@lists.php.net to get a copy of this message
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... ---- Manual Page -- http://www.php.net/manual/en/function.register-shutdown-function.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49643 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49643&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49643&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49643&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49643&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49643&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49643&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84449) next »