For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > May 2006 > #37537 [Opn->Ver]: __toString documentation update









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #37537 [Opn->Ver]: __toString documentation update
bjori@php.net

2006-05-26, 7:58 am

ID: 37537
Updated by: bjori@php.net
-Summary: Throwing exceptions in __tostring is not supported
Reported By: mfischer@php.net
-Status: Open
+Status: Verified
Bug Type: Documentation problem
Operating System: Any
-PHP Version: Irrelevant
+PHP Version: PHP5.2.0
New Comment:

http://php.net/oop5.magic#language.oop5.magic.tostring
needs an updated before 5.2.0.

#1 Can't throw exceptions anymore
#2 Is called 'wherever it's appropriate' (e.
printf("__toString: %s", $obj))

If language.exceptions will be updated to note where
exceptions can't be thrown it'll need to note lot more then
just __toString()


Previous Comments:
------------------------------------------------------------------------

[2006-05-21 05:27:56] mfischer@php.net

Description:
------------
From zend_object_handlers.c:

zend_error(E_ERROR, "Method %v::__toString() must not throw an
exception", ce->name);

This is due the recent changes that from now on __toString will be
called everywhere an object is used in a string context.

Good page candidates are:
http://de.php.net/manual/en/language.exceptions.php
http://de.php.net/manual/en/language.oop5.magic.php



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=37537&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com