Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85710 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24497 invoked from network); 3 Apr 2015 15:31:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2015 15:31:18 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.179 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.179 mail-wi0-f179.google.com Received: from [209.85.212.179] ([209.85.212.179:38799] helo=mail-wi0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/00-23347-342BE155 for ; Fri, 03 Apr 2015 10:31:17 -0500 Received: by wibgn9 with SMTP id gn9so143370170wib.1 for ; Fri, 03 Apr 2015 08:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=eqgGDUAz4LtShtC/wV7LPMKm5vBnrsXkbMo5Vughmfw=; b=w2k7PZDEGDuJhObtFJ1SWzEJOBK/dKbgPYgceU6ea2kJWw2Vsu/vXOdLhnC7CUdAnW 3JlRhJq5X4BKKkZZHEo72Ql8Nn+j7JqSlAWkHLkfH4DSkPeaGSGBoFQ6UCLmOu/LRPfU wWKGogc7Ub/Z0dfXb0hqqSQYtk/I0K0YBbW73JxkYIoHdAJWt/K7/y9etq5x3zc4Wz+A FBy1F6EX+APYnhndAFevuuKvPMEf3orBck+NN0RF6+5Zw6Ch74JhOkbq8yXMdAsykx2k 9sAgEVPnM42K/UtSAE01lxRWShKddgj9dJ7zVai17RLfbBXeNpU3TtiU5gIT4NkJJhHo fibw== MIME-Version: 1.0 X-Received: by 10.180.10.234 with SMTP id l10mr6519395wib.27.1428075072603; Fri, 03 Apr 2015 08:31:12 -0700 (PDT) Received: by 10.27.85.216 with HTTP; Fri, 3 Apr 2015 08:31:12 -0700 (PDT) In-Reply-To: References: Date: Fri, 3 Apr 2015 17:31:12 +0200 Message-ID: To: Dan Ackroyd Cc: Dmitry Stogov , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c2b3486a4b3e0512d3a37a Subject: Re: [PHP-DEV] [RFC][VOTE] Constructor behaviour of internal classes From: nikita.ppv@gmail.com (Nikita Popov) --001a11c2b3486a4b3e0512d3a37a Content-Type: text/plain; charset=UTF-8 On Wed, Apr 1, 2015 at 3:31 AM, Dan Ackroyd wrote: > Hi Dmitry, > > Your approach is definitely a better one, and I have no objection to > it whatsoever. > > Sorry, I was too busy to look deeply at each class but I can't see any > problems. > > Nikita Popov wrote: > > does that mean that the same code using strict_types=1 mode will start > > throwing TypeException instead of whatever exception type is passed > > to replace_error_handling? > > That's going to affect everything isn't it - not just this RFC? > > However I think that is the correct behaviour. It more closely > resembles the behaviour that will be seen in userland code, and is > more 'semantically' meaningful i.e. it allows people to tell the cases > between the two types of errors apart. > > It probably bears more thinking about though. > > cheers > Dan > > > > $formatInfoList = [ > ["en_US", "{0,number,integer} monkeys on {1,number,integer} trees > make {2,number} monkeys per tree"], > ["en_US", '{this was made intentionally incorrect}'], //valid type > but wrong value > ["en_US", new StdClass] //wrong type > ] > > > foreach ($formatInfoList as $formatInfo) { > list($locale, $pattern) = formatInfo; > try { > $mf = new MessageFormatter($locale, $pattern); > echo $mf->format(array(4560, 123, 4560/123)); > } > catch(IntlException $ie) { > // A strict type-est person would not want this to catch the case > where > // the wrong type has been passed, as it's not an exception > related to Intl > // it's an exception related to the type being wrong. > } > } > PR for throwing TypeException (independently of strict mode) for zpp failures in constructors is here: https://github.com/php/php-src/pull/1215 Will apply it if nobody sees a problem with it. Nikita --001a11c2b3486a4b3e0512d3a37a--