note 129642 added to exception.tostring

From: Date: Mon, 08 Jul 2024 21:14:51 +0000
Subject: note 129642 added to exception.tostring
Groups: php.notes 
Request: Send a blank email to php-notes+get-221414@lists.php.net to get a copy of this message
The Exception __toString implementation will also include the string representation of previous exceptions chained to this exception, _before_ the string representation of the current exception. For example: <?php class OuterException extends Exception {} class MiddleException extends Exception {} class InnerException extends Exception {} $excA = new InnerException("inner exception", 0); $excB = new MiddleException("middle exception", 0, $excA); $excC = new OuterException("outer exception", 0, $excB); echo "The exception is:\n$excC"; ?> will print the following: The exception is: InnerException: inner exception in test.php:6 Stack trace: #0 {main} Next MiddleException: middle exception in test.php:7 Stack trace: #0 {main} Next OuterException: outer exception in test.php:8 Stack trace: #0 {main} ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 163.116.144.109) ---- Manual Page -- https://php.net/manual/en/exception.tostring.php Edit -- https://main.php.net/note/edit/129642 Del: integrated -- https://main.php.net/note/delete/129642/integrated Del: useless -- https://main.php.net/note/delete/129642/useless Del: bad code -- https://main.php.net/note/delete/129642/bad+code Del: spam -- https://main.php.net/note/delete/129642/spam Del: non-english -- https://main.php.net/note/delete/129642/non-english Del: in docs -- https://main.php.net/note/delete/129642/in+docs Del: other reasons-- https://main.php.net/note/delete/129642 Reject -- https://main.php.net/note/reject/129642 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221414) next »