|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-04-13 16:50 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 12:00:02 2025 UTC |
Description: ------------ Adding (string) cast to an exception object on output causes PHP to output the object identifier rather then executing __toString() and printing the defined text. Removing the (string) cast on output makes the desired behaviour occur (print "Test 123"). Reproduce code: --------------- <?php class E extends Exception { public function __toString() { return "Test 123"; } } try { throw new E(); } catch (E $e) { echo (string) $e; } ?> Expected result: ---------------- Test 123 Actual result: -------------- Object id #1