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; + + + + +