Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118839 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35670 invoked from network); 18 Oct 2022 11:32:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Oct 2022 11:32:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AE69D180054 for ; Tue, 18 Oct 2022 04:32:38 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 18 Oct 2022 04:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1666092756; bh=s+o5Q5W1ug0gj8jLAsvDw025BV7avYGxbsFlGyTL4Hg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=aHvYmXDhs/RFShNvdvnnPbwdaEE9qTmhx57g/QbtTYo6DgiiccCbsBIvLWTUyWLmG iwc0fq3Pd0CT/Do+GqBDefONkwpV8WrRz9JpjyzvkTtulYGbIhIA3FS/YwjJd3NcZB kBgMOIEODxanbsVauVSz5ahokhc3y0iyMfO3G0CtkFx+BUJLrOCByeGrEuT81VJStT pA7aYwR+eoYFNZb8AZfQOaUapTmL7lZRauyCFR3MzMDPxqYLBHo5H0zBCm0Y5EwlyE t441gmEUpLSCnxSZAY4+q/3G35HfMv+5x9ksqkN4w6BXeGVpatrktbVGtqwcDiiRhm FoqFRBcofjylw== Message-ID: Date: Tue, 18 Oct 2022 13:32:32 +0200 MIME-Version: 1.0 Content-Language: en-US To: Derick Rethans , internals@lists.php.net, Tim Starling References: <22177032-fe72-c39b-63fe-fa4368a70852@bastelstu.be> <55F182F5-BA73-4224-BEE8-26C393078284@derickrethans.nl> In-Reply-To: <55F182F5-BA73-4224-BEE8-26C393078284@derickrethans.nl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [VOTE] Improve unserialize() error handling From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 10/18/22 09:32, Derick Rethans wrote: >> If I'm reading the implementation correctly, the original exception >> is thrown away, there's no way to get the >> original message and backtrace. >> That will make debugging more difficult. > > I believe that is not true. It should be wrapped and accessible through ->previous on the exception. > Correct, the original Exception/Error will be available using $e->getPrevious(). This is also explained in the RFC in the "Add wrapper Exception 'UnserializationFailedException'" section: > The original \Throwable will be accessible through the $previous property of \UnserializationFailedException, allowing the developer to learn about the actual cause of the unserialization failure by inspecting ->getPrevious(). This is not apparent from taking a cursory look at the diff of the native implementation in the pull request, because setting $previous will happen implicitly whenever native code throws an Exception, while an Exception is already "active". Best regards Tim Düsterhus