Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77179 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74153 invoked from network); 14 Sep 2014 12:17:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Sep 2014 12:17:37 -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.170 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:51167] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/E1-53483-06785145 for ; Sun, 14 Sep 2014 08:17:37 -0400 Received: by mail-vc0-f170.google.com with SMTP id hy4so2462320vcb.1 for ; Sun, 14 Sep 2014 05:17:33 -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=5hWZvgo/kS5ilFW7MLWi3VTlYrz206tOwoSi2u8ywRc=; b=CsCZnLAqHX/0Jc4t4MS5mdlfVn8eVVm3wV+B/M5miWpT6SEtHgObrBIvWwgkInokbx mJusBpO1WR5z5fd9BQLqxBhP4dz0STcBWj2vTnix2fQb/And+WTdCcCQtoxp/Z2t2KuB Ow0oWRIMZKD8rpQ+CIu3FUMt8ymzVnIi/P6XislFxzhR6Go/JaS5R14xWcYGJ4Y8JRCr +GPjKVfxe9Lx9yTHL7mBSko2KOhge3WOgaW1sQUwPdxFrLRLP3pybr0h5+1xk648xD2T jgT+Ze0UdMgL5Dg6U9R3fjZdzJpGFyaeLk0nXmDSpXXoHMX1IUzzffd2mvFRUUoluRX4 7lhQ== X-Gm-Message-State: ALoCoQmnHZfzushVAAKxvgW5KPhp2PSTv240rtfEw0EtWYBfHsVc6TbBUucc7VhiV+G4DrCZffwDu0PQiwthxWj3bnpEKNJ0tlPmGgeZS1yF4sb7V4MeIMJhv2UGDeX6TetYVqYpr9f45ptiH+uvsvZ807hUEwKyUg== X-Received: by 10.220.169.2 with SMTP id w2mr17675979vcy.33.1410697053501; Sun, 14 Sep 2014 05:17:33 -0700 (PDT) References: <6893A97A-EC4C-4124-B804-96E2A26B953F@ajf.me> <20140914000718.GB14312@phcomp.co.uk> <3177B936-50C1-4E5D-8687-FD235C72B411@ajf.me> <54153692.7050500@sugarcrm.com> <9CE963B0-E624-4267-BC2A-0F8D1F985DAE@ajf.me> In-Reply-To: <9CE963B0-E624-4267-BC2A-0F8D1F985DAE@ajf.me> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQH5MaeemLSb1j8ep/xQjNgxWkCohgKCBGZJAZwOL3sB2X0+HwIihyKTm2z2S8A= Date: Sun, 14 Sep 2014 15:17:32 +0300 Message-ID: <6f2236e18c61d30b247e1c6bb2de10f1@mail.gmail.com> To: Andrea Faulds , Stas Malyshev Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] [VOTE][RFC] Scalar Type Hinting with Cast From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Andrea Faulds [mailto:ajf@ajf.me] > Sent: Sunday, September 14, 2014 3:08 PM > To: Stas Malyshev > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] [VOTE][RFC] Scalar Type Hinting with Cast > > > The problem is that we *can't* be consistent. Internal functions already live in > this completely different world from user land functions. Nullability is handled > differently. They use implicit casts in places as if they were user land functions > with no parameter types at all. In other places they have strongly typed > parameters. If they are passed invalid data, they usually just return NULL and > emit a warning, though this depends on the function. User land functions, by > contrast, will emit a recoverable error if the wrong type is passed. To make > these two consistent would require massive backwards-compatibility breaks. I honestly don't see why we can't be consistent for the simple types, or at least strive to be as consistent as possible as opposed to introducing a complete parallel universe for userland functions, that's inconsistent with the entirety of the rest of PHP. We don't have to be consistent with ALL internal functions, which obviously have the option of doing custom checks and return failures not only if you fail to, say, pass on a string - but also if that string is not of a special format. But then, you have the option of doing that also in userland functions using custom code. The question is not the customized cases - it's the standard behavioral cases - comparing zpp rules for scalars and the newly-introduced rules for userland scalars. We could definitely strive to be consistent; Introduce some changes to the implicit casting rules for internal functions and implement the very same rules for this brand new userland functions. I'm definitely against this RFC in its current form. Zeev