Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58809 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56053 invoked from network); 9 Mar 2012 08:36:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2012 08:36:20 -0000 Authentication-Results: pb1.pair.com header.from=simonsimcity@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=simonsimcity@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: simonsimcity@googlemail.com X-Host-Fingerprint: 209.85.214.170 mail-tul01m020-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:64939] helo=mail-tul01m020-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/07-10820-301C95F4 for ; Fri, 09 Mar 2012 03:36:19 -0500 Received: by obbwd1 with SMTP id wd1so1940175obb.29 for ; Fri, 09 Mar 2012 00:36:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=IpnZiIGo/y1wIP8KfwBiDz97YU4/U6hI2Y5LbeQyVVI=; b=mVAz/D6k70gKkUKN4VagENZgT2QT7kuJ6Zt/0oqiDHHDMwmxicVpMUXiRZnKCIrQcc pghiKSZo5HoMnIn7I5RIyb1HVjeLs4wW8epMNUvM4Ia2zaT6f8eK8pOhFB9AT+cC85qV qMvTCV20rn3e7kxD2F/VUgHWs/Y7Vf/oSSkHGFdxlanKSXAVAMqY/93uobwAGv2BwI/q 6LPYY1pjJfjlAx6b+6Q1FkFe5cPLQWps+VgdKo8k+VlepqZgRSDTnqHDypAAlcstuBog 56CzykWCDpBLHn2Mu2A7MoW7Qd2MVfHCkGynyR95PuP1I0OlICAquqEDt2Vhqruh6UXo S/BQ== MIME-Version: 1.0 Received: by 10.182.12.74 with SMTP id w10mr523002obb.51.1331282176845; Fri, 09 Mar 2012 00:36:16 -0800 (PST) Received: by 10.60.63.70 with HTTP; Fri, 9 Mar 2012 00:36:16 -0800 (PST) In-Reply-To: References: Date: Fri, 9 Mar 2012 09:36:16 +0100 Message-ID: To: Nikita Popov Cc: Anthony Ferrara , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters From: simonsimcity@googlemail.com (Simon Schick) Hi, all At first, many thanks to Anthony for writing the code! 2012/3/9 Anthony Ferrara > fooi(1.5); // int(1) Here an E_NOTICE would be a minimum as we are modifying the data. I'd like to see an E_RECOVERABLE_ERROR as well. You should use float-casting instead if you want to allow this as well. And this should be the only difference between int and float. (Float will of course also accept strings like "1.5") One more question I have to raise here ... is ".5" a valid float? Or do I have to change it to "0.5" to get it valid? 2012/3/9 Nikita Popov > > a) I'm not sure that we really want to accept '123abc' on an int cast > with just a notice. In my eyes that is clearly malformed input, which > should not be accepted. In my opinion '123abc' is not a valid integer as well. 2012/3/9 Nikita Popov > > b) The bool cast rules also accept lots of input with dataloss. At > least the fact that "abc" is considered a valid bool seems odd. I think all values that are not castable to an integer 0 or 1 should fail in Boolean. I pretty much like the rest. But as we are allowing classes implementing __toString() we should also think about updating the array type-cast - but that's another discussion that we can pick up later. Bye Simon