svn: /phpdoc/en/trunk/language/oop5/ magic.xml
| From: | Adam Harvey | Date: | Wed, 05 Dec 2012 01:19:20 +0000 |
| Subject: | svn: /phpdoc/en/trunk/language/oop5/ magic.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-10834@lists.php.net to get a copy of this message | ||
aharvey Wed, 05 Dec 2012 01:19:20 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=328669
Log:
Add a warning about the fatal error generated when you throw from __toString().
Prompted by bug #50699, although it doesn't really fix it as such.
Bug: https://bugs.php.net/50699 (Not a bug) Cannot throw
Exceptions in __toString()
Changed paths:
U phpdoc/en/trunk/language/oop5/magic.xml
Modified: phpdoc/en/trunk/language/oop5/magic.xml
===================================================================
--- phpdoc/en/trunk/language/oop5/magic.xml 2012-12-04 23:12:03 UTC (rev 328668)
+++ phpdoc/en/trunk/language/oop5/magic.xml 2012-12-05 01:19:20 UTC (rev 328669)
@@ -136,6 +136,13 @@
return a string, as otherwise a fatal <constant>E_RECOVERABLE_ERROR</constant>
level error is emitted.
</para>
+ <warning>
+ <simpara>
+ You cannot throw an exception from within a
+ <link linkend="object.tostring">__toString()</link> method. Doing so
will
+ result in a fatal error.
+ </simpara>
+ </warning>
<example>
<title>Simple example</title>
<programlisting role="php">