Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86863 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83299 invoked from network); 25 Jun 2015 13:55:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jun 2015 13:55:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:58569] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/20-16095-4580C855 for ; Thu, 25 Jun 2015 09:55:33 -0400 Received: by mail.experimentalworks.net (Postfix, from userid 1003) id 38E944C36A; Thu, 25 Jun 2015 15:56:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on km31408.keymachine.de X-Spam-Level: * X-Spam-Status: No, score=1.4 required=4.0 tests=ALL_TRUSTED, DNS_FROM_AHBL_RHSBL autolearn=no version=3.3.2 X-Spam-HAM-Report: * 2.4 DNS_FROM_AHBL_RHSBL RBL: Envelope sender listed in dnsbl.ahbl.org * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Received: from [192.168.2.34] (ppp-93-104-4-30.dynamic.mnet-online.de [93.104.4.30]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 3B2774C118; Thu, 25 Jun 2015 15:56:09 +0200 (CEST) Message-ID: <1435240516.15676.7.camel@kuechenschabe> To: Nikita Popov Cc: PHP internals , Dmitry Stogov Date: Thu, 25 Jun 2015 15:55:16 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Allow exceptions in __toString() From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Thu, 2015-06-25 at 14:52 +0200, Nikita Popov wrote: > However what it doesn't do, and what I wouldn't consider feasible to do, is > ensure that every single string conversion in library functions is > exception safe. Personally I don't think this is a blocking issue, as the > worst that can happen is usually an additional superfluous warning to be > thrown, or something similar. If cases like this turn up, we can > specifically target them. I don't agree to the assesment that this isn'T a problem. Consider this extension pseudo-code: zval *data = get_data(); convert_to_string(data); store_into_database(Z_STRVAL_P(data)); return TRUE; This will store wrong data in the database and report to the user that there was an error before storing, so the user assumes nothing was stored. The only way we can do that imo is by bailing out if an exception is thrown and introducing yet another set of string conversion functions for marking exception safe uses. (i.e. convert_to_string_throwing()) johannes