Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67381 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47423 invoked from network); 9 May 2013 22:00:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 May 2013 22:00:28 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.212.46 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.212.46 mail-vb0-f46.google.com Received: from [209.85.212.46] ([209.85.212.46:50747] helo=mail-vb0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/10-45230-A7C1C815 for ; Thu, 09 May 2013 18:00:26 -0400 Received: by mail-vb0-f46.google.com with SMTP id 10so2987289vbe.33 for ; Thu, 09 May 2013 15:00:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:date:x-google-sender-auth:message-id :subject:from:to:content-type:x-gm-message-state; bh=WIzfBu+RyiYrBoLbKj7mEaEJaPOTBoG/O1QH/OgcitQ=; b=WGqdI0JhvtBm1lfzDm7/EiK+AusfxOx46Oc1lo3aWzNkoUZOzSwRzFdF5nAydxAX8O gRk4st1lefmJaj4tsF4wwq1qHqsXIh5HnSg02rvXm5POwx8JZKh1gDqNWCcYs01GHp4c wLwJa1OBL06qHJ65pcLVoY0/CO1dOmxY8hd8J14DenDRUzhzfGvFfKnMtbMbEtp7L62E +JKmHAKAMH3lc9Ald4wEpBK9wJ+2f+rfQ+bZA8Xyuyo9x0Fq/vBEMBktfRunNYAwHiUr 1x5rC6WDp/EABov9Un8VaDXcu9ho6W/Zt/QM5B7WP03XbgI09wLTxBfH0FnOb5LOOtEf UYXA== MIME-Version: 1.0 X-Received: by 10.58.80.4 with SMTP id n4mr9207030vex.5.1368136823677; Thu, 09 May 2013 15:00:23 -0700 (PDT) Sender: rasmus@mindplay.dk Received: by 10.58.28.134 with HTTP; Thu, 9 May 2013 15:00:23 -0700 (PDT) Date: Thu, 9 May 2013 18:00:23 -0400 X-Google-Sender-Auth: L4Mq32OC8CErgXnDyyezXRMYpt4 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=047d7b5d626461385704dc502dae X-Gm-Message-State: ALoCoQnyShlYysSxNY+rGzqp+YkOsvJKn0/2jyFVhy5pUnnJibMTbEgLeOtqOdBaRdjpSu9+Frx3 Subject: exceptions during __toString() From: me@rasmus-schultz.com (Rasmus Schultz) --047d7b5d626461385704dc502dae Content-Type: text/plain; charset=ISO-8859-1 I just ran into this issue again: http://stackoverflow.com/questions/2429642/why-its-impossible-to-throw-exception-from-tostring Instead of throwing some nonsense "you're not allowed to throw from here" error-message, how about actually unwinding the stack and passing the exception to the global exception-handler? I understand there's a technical limitation making it difficult/impossible to handle exceptions during __toString() - and it looks like you can still try {...} catch (Exception $e) in __toString() just fine, but then what? You have the exception, but you have no way to pass it to the standard global exception-handler. If the script has to terminate either way, why not terminate the same way an unhandled exception would normally cause the script to terminate? E.g. output the actual error-message, or pass it to whatever was registered with register_exception_handler() so it can be output or handled in the usual way? --047d7b5d626461385704dc502dae--