svn: /phpdoc/en/trunk/ language/oop5/decon.xml reference/funchand/functions/register-shutdown-function.xml reference/misc/functions/exit.xml
| From: | Daniel Egeberg | Date: | Mon, 25 Jan 2010 15:28:23 +0000 |
| Subject: | svn: /phpdoc/en/trunk/ language/oop5/decon.xml reference/funchand/functions/register-shutdown-function.xml reference/misc/functions/exit.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-5924@lists.php.net to get a copy of this message | ||
degeberg Mon, 25 Jan 2010 15:28:23 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=293992
Log:
Mentioning that shutdown functions and object destructors will be called even if exit() is called.
Changed paths:
U phpdoc/en/trunk/language/oop5/decon.xml
U phpdoc/en/trunk/reference/funchand/functions/register-shutdown-function.xml
U phpdoc/en/trunk/reference/misc/functions/exit.xml
Modified: phpdoc/en/trunk/language/oop5/decon.xml
===================================================================
--- phpdoc/en/trunk/language/oop5/decon.xml 2010-01-25 15:27:11 UTC (rev 293991)
+++ phpdoc/en/trunk/language/oop5/decon.xml 2010-01-25 15:28:23 UTC (rev 293992)
@@ -97,6 +97,11 @@
explicitly call <function>parent::__destruct</function> in the destructor
body.
</para>
+ <para>
+ The destructor will be called even if script execution is stopped using
+ <function>exit</function>. Calling <function>exit</function> in a
destructor
+ will prevent the remaining shutdown routines from executing.
+ </para>
<note>
<para>
Destructors called during the script shutdown have HTTP headers already
Modified: phpdoc/en/trunk/reference/funchand/functions/register-shutdown-function.xml
===================================================================
--- phpdoc/en/trunk/reference/funchand/functions/register-shutdown-function.xml 2010-01-25 15:27:11
UTC (rev 293991)
+++ phpdoc/en/trunk/reference/funchand/functions/register-shutdown-function.xml 2010-01-25 15:28:23
UTC (rev 293992)
@@ -16,7 +16,8 @@
</methodsynopsis>
<para>
Registers the function named by <parameter>function</parameter> to be
- executed when script processing is complete.
+ executed when script processing is complete or when <function>exit</function>
+ is called.
</para>
<para>
Multiple calls to <function>register_shutdown_function</function> can be
Modified: phpdoc/en/trunk/reference/misc/functions/exit.xml
===================================================================
--- phpdoc/en/trunk/reference/misc/functions/exit.xml 2010-01-25 15:27:11 UTC (rev 293991)
+++ phpdoc/en/trunk/reference/misc/functions/exit.xml 2010-01-25 15:28:23 UTC (rev 293992)
@@ -18,6 +18,9 @@
</methodsynopsis>
<para>
Terminates execution of the script.
+ <link linkend="function.register-shutdown-function">Shutdown
functions</link>
+ and <link linkend="language.oop5.decon.destructor">object
destructors</link>
+ will always be executed even if <function>exit</function> is called.
</para>
</refsect1>
@@ -97,6 +100,42 @@
</programlisting>
</example>
</para>
+ <para>
+ <example>
+ <title>Shutdown functions and destructors run regardless</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+class Foo
+{
+ public function __destruct()
+ {
+ echo 'Destruct: ' . __METHOD__ . '()' . PHP_EOL;
+ }
+}
+
+function shutdown()
+{
+ echo 'Shutdown: ' . __FUNCTION__ . '()' . PHP_EOL;
+}
+
+$foo = new Foo();
+register_shutdown_function('shutdown');
+
+exit();
+echo 'This will not be output.';
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+ <![CDATA[
+ Shutdown: shutdown()
+ Destruct: Foo::__destruct()
+ ]]>
+ </screen>
+ </example>
+ </para>
</refsect1>
<refsect1 role="notes">