From 33f7afff506c2d1815f00a06763d359c8d740f56 Mon Sep 17 00:00:00 2001 From: Daniel Egeberg Date: Mon, 25 Jan 2010 15:28:23 +0000 Subject: [PATCH] Mentioning that shutdown functions and object destructors will be called even if exit() is called. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@293992 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/oop5/decon.xml | 5 +++ .../functions/register-shutdown-function.xml | 3 +- reference/misc/functions/exit.xml | 39 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/language/oop5/decon.xml b/language/oop5/decon.xml index 16179e8ba8..09da2939cf 100644 --- a/language/oop5/decon.xml +++ b/language/oop5/decon.xml @@ -97,6 +97,11 @@ $obj = new MyDestructableClass(); explicitly call parent::__destruct in the destructor body. + + The destructor will be called even if script execution is stopped using + exit. Calling exit in a destructor + will prevent the remaining shutdown routines from executing. + Destructors called during the script shutdown have HTTP headers already diff --git a/reference/funchand/functions/register-shutdown-function.xml b/reference/funchand/functions/register-shutdown-function.xml index 4e42a3d1ce..bcc772fa7f 100644 --- a/reference/funchand/functions/register-shutdown-function.xml +++ b/reference/funchand/functions/register-shutdown-function.xml @@ -16,7 +16,8 @@ Registers the function named by function to be - executed when script processing is complete. + executed when script processing is complete or when exit + is called. Multiple calls to register_shutdown_function can be diff --git a/reference/misc/functions/exit.xml b/reference/misc/functions/exit.xml index e6dd243bb1..8a5b4bc68a 100644 --- a/reference/misc/functions/exit.xml +++ b/reference/misc/functions/exit.xml @@ -18,6 +18,9 @@ Terminates execution of the script. + Shutdown functions + and object destructors + will always be executed even if exit is called. @@ -97,6 +100,42 @@ exit(0376); //octal + + + Shutdown functions and destructors run regardless + + +]]> + + &example.outputs; + + + + +