Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75498 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46827 invoked from network); 14 Jul 2014 17:31:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2014 17:31:26 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.181 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.220.181 mail-vc0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:60962] helo=mail-vc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/50-45205-DE314C35 for ; Mon, 14 Jul 2014 13:31:25 -0400 Received: by mail-vc0-f181.google.com with SMTP id lf12so4087396vcb.12 for ; Mon, 14 Jul 2014 10:31:22 -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=eqo2/aoCeUZF686P1XyGDv15VgOwUJ66GczmUbm3ZVI=; b=kFAr1VHV9JSsygd97tEfCqwRoTE9UnAqZ1xXMTdb+d7OzHbZYUTeAUqB3P2m+syTGN 5YKwQR56BqIWt66mEBXihirVAkelwAnZAtxh32+8SI+hiDUPeyif70AnOm6ln/pTWqNl cvOFvS3Kg8eKcpd7TmP5xwq1frrdpvsUlXyFVpQunngQwIJp8UThrx4udCrxiqCPwHev 1os7TGSf0eXYNXWYJ+YCYrrjS//X05ioG5S5nP2Slsl++FbWCaF7oHLGGR7fKL64ZbUm UMcdIAoLc2LHqs6gN9XquPx70wqy3+UqLJFuZQTaCpgcTOnu9j8lXKT7+ZUjRYQdYylf 0OUQ== MIME-Version: 1.0 X-Received: by 10.220.2.136 with SMTP id 8mr17214703vcj.17.1405359082693; Mon, 14 Jul 2014 10:31:22 -0700 (PDT) Received: by 10.58.45.137 with HTTP; Mon, 14 Jul 2014 10:31:22 -0700 (PDT) In-Reply-To: <5f491f470e902489f036102ae0f437f8@mail.gmail.com> References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <53C3F70A.7010706@gmail.com> <3aa29e080d70c843713e19a952dfbad6@mail.gmail.com> <3b06c592b0b88bb95d3ae7ea7a93d86f@mail.gmail.com> <6AF150D1-1398-43CA-977A-3CF3D51719F4@ajf.me> <5b53012f7b5437d85cdf9972194aa34f@mail.gmail.com> <53C408EC.7080104@gmail.com> <5f491f470e902489f036102ae0f437f8@mail.gmail.com> Date: Mon, 14 Jul 2014 13:31:22 -0400 Message-ID: To: Zeev Suraski Cc: Rowan Collins , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: ircmaxell@gmail.com (Anthony Ferrara) Zeev, >> And passing 'hello' to a function type hinted as int? Will people really >> expect >> that to become a 0, with a mild warning they may not even have enabled? > > I'd say absolutely yes, if they're PHP developers that's exactly what they'd > expect. After all, if you use 'hello' today in any integer context in PHP, > explicit or implicit, that's exactly how it will behavior across the > language. Compare: $ php -r 'var_dump(substr("abc", "1"));' string(2) "bc" $ php -r 'var_dump(substr("abc", "1sf"));' PHP Notice: A non well formed numeric value encountered in Command line code on line 1 string(2) "bc" $ php -r 'var_dump(substr("abc", "apple"));' PHP Warning: substr() expects parameter 2 to be long, string given in Command line code on line 1 NULL So it's not really how it behaves across the language (especially since the common paradigm is not run the function if zpp fails, which it will when passing "apple" to a function expecting an int).