Re: asString() method vs __toString() magic method.
| From: | Richard Quadling | Date: | Tue, 02 Aug 2011 15:56:07 +0000 |
| Subject: | Re: asString() method vs __toString() magic method. | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-54292@lists.php.net to get a copy of this message | ||
On 2 August 2011 16:09, Keloran <ava3ar@gmail.com> wrote:
> i didnt think any of the magic functions could throw exceptions
All magic methods can throw exceptions except __toString.
There is some oddity with __set_state() (in terms of the pattern of
output is different).
http://pastebin.com/nGkP7kKf
outputs ...
In : failure2::__construct
Thrown exception in : failure2::__construct
In : failure1::__get
Thrown exception in : failure1::__get
In : failure1::__set
Thrown exception in : failure1::__set
In : failure1::__call
Thrown exception in : failure1::__call
In : failure1::__callStatic
Thrown exception in : failure1::__callStatic
In : failure1::__isset
Thrown exception in : failure1::__isset
In : failure1::__unset
Thrown exception in : failure1::__unset
In : failure1::__invoke
Thrown exception in : failure1::__invoke
In : failure1::__clone
Thrown exception in : failure1::__clone
DateTime::__set_state(array(
'date' => '2011-08-02 16:54:03',
'timezone_type' => 3,
'timezone' => 'Europe/London',
))
In : failure3::__destruct
Thrown exception in : failure3::__destruct
In : failure1::__sleep
Thrown exception in : failure1::__sleep
In : failure1::__wakeup
Thrown exception in : failure1::__wakeup
But __toString() throws a Fatal Error.
--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea