Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87464 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14637 invoked from network); 31 Jul 2015 22:23:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2015 22:23:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.181 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.181 mail-wi0-f181.google.com Received: from [209.85.212.181] ([209.85.212.181:34278] helo=mail-wi0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/A4-24609-255FBB55 for ; Fri, 31 Jul 2015 18:23:15 -0400 Received: by wibud3 with SMTP id ud3so73379249wib.1 for ; Fri, 31 Jul 2015 15:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to:cc :message-id; bh=h+meNyk3JpxlVQfbaIfG+zzC5P85LUX9z3mHIy4O67E=; b=PHt37+poPtIUj1JRM4RJOQLcbrBhSfzPTphgDhMMSktvWISC1aOrQY8eOkh9RxelJG 2g6FvAQdxIP7OO/k4ycmjOWXKWyCCcUbpR/x7Z78ocPg/B1A58DKmqjd9Ie5i+fjVdnD e961mjHzN6kY1pWhyYJRPiMpphegkt/cpq48fa3e6hsvfRUqulG3/1zsrFGqUZ3U+Qde BYgMj1LO5G+QcuooXRM0KbEvAUmmHU88UNqrkHeMl8/klRmm5bct3VLog7azeIRMXay0 KakPtcwEyLh/EdoRICEYWhUG2z2WazBm9QXyBogBgKk5suszwqoxKRU9WOinIQGo2FwW 2EOQ== X-Received: by 10.194.89.5 with SMTP id bk5mr10947765wjb.144.1438381391831; Fri, 31 Jul 2015 15:23:11 -0700 (PDT) Received: from [192.168.0.6] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by smtp.gmail.com with ESMTPSA id mc4sm6589286wic.6.2015.07.31.15.23.10 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jul 2015 15:23:10 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: <55BBD2EE.2070008@gmail.com> References: <550FA2ED.6080000@gmail.com> <55B7B08E.7070700@gmail.com> <55BBD2EE.2070008@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Fri, 31 Jul 2015 23:20:58 +0100 To: Stanislav Malyshev CC: PHP Internals Message-ID: Subject: Re: [PHP-DEV] Re: Serializing exceptions From: rowan.collins@gmail.com (Rowan Collins) On 31 July 2015 20:56:30 BST, Stanislav Malyshev wrote: >Hi! > >> Personally I feel the restoring them impossible argument weak, >consider >> that we allow stuff like serializing resources without even a notice. > >Not sure what you mean by that. If you try to serialize resource, you >just get an integer. Not ideal, as a remanant of the times in PHP where >the approach was "if it doesn't make sense, do whatever and hope the >user is ok with that", but certainly it's not "serializing resources". >It's "ignoring resources when serializing and producing integers >instead". Replacing Exceptions with integers probably won't work that >well :) > >> Based on my own experiences where I had to fix multiple apps when we >> introduced the unserializable Closure (mostly error logger and >debugging >> tools) which got passed as argument in the backtrace I would prefer >if >> we could remove that restriction. > >I don't see how we can really remove the underlying problem - >Exceptions >contain backtraces, which means serializing them tries to serialize a >ton of stuff that may be not only not serializable but outright >dangerous As I have pointed out several times, it is only the 'args' section of the backtrace that ever contains unserializable items. The solution is simply not to include that argument - equivalent to setting DEBUG_BACKTRACE_IGNORE_ARGS in a debug_backtrace() call. IIRC the object of called methods is already excluded (equivalent to masking out DEBUG_PROVIDE_OBJECT) so what's left is all strings. I would have thought that genuine use cases for extracting arbitrary arguments out of an exceptions backtrace would be pretty rare. Regards, -- Rowan Collins