Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84574 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3203 invoked from network); 11 Mar 2015 20:37:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2015 20:37:31 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:59581] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/90-32765-987A0055 for ; Wed, 11 Mar 2015 15:37:30 -0500 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 762C7E202F; Wed, 11 Mar 2015 20:37:26 +0000 (GMT) Date: Wed, 11 Mar 2015 20:37:26 +0000 (GMT) X-X-Sender: derick@whisky.home.derickrethans.nl To: Zeev Suraski cc: Anthony Ferrara , internals@lists.php.net In-Reply-To: <2d48b241e682e59df6ab876b42663628@mail.gmail.com> Message-ID: References: <76c47c6fbd961958c10bc1a069377a34@mail.gmail.com> <2d48b241e682e59df6ab876b42663628@mail.gmail.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: RE: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints From: derick@php.net (Derick Rethans) On Wed, 11 Mar 2015, Zeev Suraski wrote: > From: Anthony Ferrara [mailto:ircmaxell@gmail.com] > > > > function bar(float $x) > > > $foo = 1; > > > bar($foo); // will definitely fail in strict mode > > > > No, actually it won't fail in strict mode: > > https://wiki.php.net/rfc/scalar_type_hints_v5#integers_should_be_accepted > > _for_strict_float_arguments > > You're right, sorry. Reverse it then: > function bar(int $x) > $foo = 1.0; > bar($foo); // will definitely fail in strict mode And it should fail, as logically it is the same as: $foo = 1.901 - 0.709 - 0.192; bar($foo); which is only 1, if you look at it with a small enough precision. cheers, Derick