vrana Fri Aug 17 21:31:07 2007 UTC
Modified files: /phpdoc/en/language/oop5 magic.xml Log: __toString() is called only in string contexts (bug #37537) http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/magic.xml?r1=1.17&r2=1.18&diff_format=u Index: phpdoc/en/language/oop5/magic.xml diff -u phpdoc/en/language/oop5/magic.xml:1.17 phpdoc/en/language/oop5/magic.xml:1.18 --- phpdoc/en/language/oop5/magic.xml:1.17 Thu Aug 16 14:16:20 2007 +++ phpdoc/en/language/oop5/magic.xml Fri Aug 17 21:31:07 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.17 $ --> +<!-- $Revision: 1.18 $ --> <sect1 xml:id="language.oop5.magic" xmlns="http://docbook.org/ns/docbook"> <title>Magic Methods</title> <para> @@ -143,6 +143,9 @@ It is worth noting that before PHP 5.2.0 the <literal>__toString</literal> method was only called when it was directly combined with <function>echo</function> or <function>print</function>. + Since PHP 5.2.0, it is called in any string context (e.g. in + <function>printf</function> with <literal>%s</literal> modifier) but not + in other types contexts (e.g. with <literal>%d</literal> modifier). Since PHP 5.2.0, converting objects without <literal>__toString</literal> method to string would cause <constant>E_RECOVERABLE_ERROR</constant>. </para>