Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75471 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2092 invoked from network); 14 Jul 2014 15:07:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2014 15:07:39 -0000 Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.182 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.182 mail-vc0-f182.google.com Received: from [209.85.220.182] ([209.85.220.182:57981] helo=mail-vc0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/32-25444-B32F3C35 for ; Mon, 14 Jul 2014 11:07:39 -0400 Received: by mail-vc0-f182.google.com with SMTP id hq11so7547210vcb.13 for ; Mon, 14 Jul 2014 08:07:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type; bh=wH+ayMQS2xbNof/01olEb30iAkiDSO4o+VFsw5jwN+0=; b=h/4IicW93IQc8ZhMQl4FfjmzrcKLnTZ4V8P202pPJQw+nklj0keQ07rk2XdjxSoKdN KhcMj1/8acgdSzLULjG79bfBJycGO5bxzJrIxqAO1Wo2lci3qKpv49aKt99NXVKm85lq ZMFEHlIXKj4ND+mO7U8d8pv7W+8AuOfRJMkiBLcYouMssjgENE91IxXtNVVAEnImjyw5 SrHnh96K9aWghYUJt4laX7oqpa9DwnqfP5KNUsFfXIuzn8E6/siA5KJxaqrG6gsyXnar taVNrywhx64oIAyOfweDUF8pBGnDthgyrEEQUJWjzEMq4eLD0z1/x6HEHK7UJWSnk0iE K+hQ== X-Gm-Message-State: ALoCoQlOZRDLq6TKo0v7AOTiZcdqm8NUOIsDgXHuaMnpwSZcp/GwwjJLF8+LrCrADV4FRWr3o12qo8jPK5e+LqgOmkmkc4q+381R4NVjTNAfq7Xk/fCIpLKJr0hTgLHbpwmk1ZbhkTxT X-Received: by 10.52.69.172 with SMTP id f12mr6333718vdu.26.1405350456077; Mon, 14 Jul 2014 08:07:36 -0700 (PDT) References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <6C08D5C1-7A37-4F49-BF12-96B614B4B50B@ajf.me> In-Reply-To: <6C08D5C1-7A37-4F49-BF12-96B614B4B50B@ajf.me> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJuUFVOlGiX172RfpkkW7aXwqSXwwHleMkPAd/qfJcBzHP03AINxCkwmiVM59A= Date: Mon, 14 Jul 2014 18:07:35 +0300 Message-ID: <8c4fa132c69f0e72d1fd963461a110c6@mail.gmail.com> To: Andrea Faulds , Derick Rethans Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Andrea Faulds [mailto:ajf@ajf.me] > Sent: Monday, July 14, 2014 5:58 PM > To: Derick Rethans > Cc: PHP internals > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > > On 14 Jul 2014, at 15:54, Derick Rethans wrote: > > > A compromise by adding more inconsistencies. > > > > I can buy the cast of scalars vs hint--of-complex types, but > > definitely not the introduction of a new group of casting rules. Keep it > simple. > > It doesn't change the casting rules; write an error handler that ignores > E_RECOVERABLE_ERROR and you get exactly the same result as a manual cast > inside the function. Rather, it simply adds validation. The casting works like > casting does everywhere else, but there's strict lossless validation on the type > hint, similar to the non-scalar type hints except more lenient as it allows > equivalent values of other types. It does, as it creates an error (recoverable or not), and it doesn't allow "13abc" to easily turn into 13 (int), even if you implement an error handler that ignores E_RECOVERABLE_ERROR. Zeev