note 117018 added to jsonserializable.jsonserialize
| From: | david at vanlaatum dot id dot au | Date: | Thu, 02 Apr 2015 02:57:45 +0000 |
| Subject: | note 117018 added to jsonserializable.jsonserialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202148@lists.php.net to get a copy of this message | ||
simonsimcity at gmail dot com is wrong, you can throw exceptions in this but it will wrap with
another exception so his example outputs
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'It
failed!' in -:8
Stack trace:
#0 [internal function]: Foo->jsonSerialize()
#1 -(16): json_encode(Object(Foo))
#2 {main}
Next exception 'Exception' with message 'Failed calling Foo::jsonSerialize()'
in -:16
Stack trace:
#0 -(0): json_encode()
#1 {main}
thrown in - on line 16
PHP 5.4.39
----
Server IP: 72.52.91.14
Probable Submitter: 203.8.17.239
----
Manual Page -- http://php.net/manual/en/jsonserializable.jsonserialize.php
Edit -- https://master.php.net/note/edit/117018
Del: integrated -- https://master.php.net/note/delete/117018/integrated
Del: useless -- https://master.php.net/note/delete/117018/useless
Del: bad code -- https://master.php.net/note/delete/117018/bad+code
Del: spam -- https://master.php.net/note/delete/117018/spam
Del: non-english -- https://master.php.net/note/delete/117018/non-english
Del: in docs -- https://master.php.net/note/delete/117018/in+docs
Del: other reasons-- https://master.php.net/note/delete/117018
Reject -- https://master.php.net/note/reject/117018
Search -- https://master.php.net/manage/user-notes.php