Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47699 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89111 invoked from network); 31 Mar 2010 23:23:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2010 23:23:37 -0000 Authentication-Results: pb1.pair.com header.from=nlgordon@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=nlgordon@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: nlgordon@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-ww0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:48713] helo=mail-ww0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/D2-04237-879D3BB4 for ; Wed, 31 Mar 2010 18:23:36 -0500 Received: by wwc33 with SMTP id 33so455183wwc.29 for ; Wed, 31 Mar 2010 16:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:received:message-id :subject:from:to:content-type; bh=DZcEcPsWxFMMgOJQJ3rIP+llriUp+CnxBlZaD0BSQLs=; b=aSx25tx0Nu0bTisjHhH73Fy///qVulEJs0hmCS22i2Rp4HeNVr5Swunm99WXkEHIYW 6D7+I9uAvQ2Z4DWB7G/uPuO4gRz+WCe8bY+ecE50Pldt5kgP35jcxgQBfYRZTzS/Ufiq 2LIfYTkD1DJPe4uSle/wWRjaN5e42eH6H1epY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Onx7S+UOtcdXpHA+QbO+NIwnG5B17I2FX5pHyuWmlBIX7S3FY2PcgN9iNkILrT88Ci BcQC1xIsncwqvGpc7mAF1+lceueqMtvDA9GRSY7+8XJdCs+lBVsYTnK0sbSuPmGGONqS OPAoSOcJQz8QZf19O5Wtf5B8M5gJ+Trqh1juc= MIME-Version: 1.0 Received: by 10.216.175.133 with HTTP; Wed, 31 Mar 2010 16:23:33 -0700 (PDT) Date: Wed, 31 Mar 2010 18:23:33 -0500 Received: by 10.216.87.66 with SMTP id x44mr1438080wee.96.1270077813410; Wed, 31 Mar 2010 16:23:33 -0700 (PDT) Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=0016e6d99c2ce7cbe2048321084d Subject: Serializing Closures From: nlgordon@gmail.com (Nate Gordon) --0016e6d99c2ce7cbe2048321084d Content-Type: text/plain; charset=UTF-8 Firstly, I'm not here to debate the merits or the how-to of serializing closures. I'm here to address the current usability issues with how it is prevented. The short background of what I'm doing is serializing backtraces when errors occur so that I can better diagnose bugs my clients report. But when a closure is passed as a function parameter somewhere in the call tree, things just flat out exlode with the error: Fatal error: Exception thrown without a stack frame in Unknown on line *0* I've gotten around the problem in the short term by catching the exception from the serialization, but then I loose my backtrace. It seems unfortunate that I need to clean my backtrace before serializing it. The error that you get when you try to serialize a Closure right now is: Exception: Serialization of 'Closure' is not allowed in ....php on line *13* While I'm perfectly fine having closures not serialize, having a closure buried in an array or object and having that error out seems like a bad thing as well. This gets even worse when trying to do this from within an error handler, you lose all context of the error since throwing exceptions/errors from within the error handler causes all sorts of bad things to happen (Exception thrown without stack frame errors). I certainly wasn't expecting serialize to be the thing that was causing the issue. Thus, would it be possible to degrade this from something as severe as an exception to being a simple warning, or just silently ignoring it and continuing with the serialization? I would compare this to resource handles for mysql connections and the like. Those are silently ignored. I'm open to thoughts, comments, and suggestions and would be willing to write a patch to make whatever changes are agreed upon. -- -Nathan Gordon If the database server goes down and there is no code to hear it, does it really go down? :wq --0016e6d99c2ce7cbe2048321084d--