Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83174 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95607 invoked from network); 19 Feb 2015 12:46:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2015 12:46:34 -0000 Authentication-Results: pb1.pair.com header.from=patrickallaert@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=patrick.allaert@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.172 as permitted sender) X-PHP-List-Original-Sender: patrick.allaert@gmail.com X-Host-Fingerprint: 74.125.82.172 mail-we0-f172.google.com Received: from [74.125.82.172] ([74.125.82.172:40222] helo=mail-we0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/81-18870-82BD5E45 for ; Thu, 19 Feb 2015 07:46:33 -0500 Received: by wesx3 with SMTP id x3so7046544wes.7 for ; Thu, 19 Feb 2015 04:46:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:references:from:date:message-id:subject:to :content-type; bh=IqxD2OXEvU25E0VtrqKv3r/fvYROXV5c4fKiMcnwi4Y=; b=eiaCciHZ2XsQ0l6RuV7f9snC7RQ1DKNDflj5gjEd2K8NitrCDafW1t4DR1ANLPjvdy PFVmVzYrXtc6N78MZ92Xja5ToKZBv5TqeE1DcV1UXhkBrWZAL27r0xM0PHBL4GPlb/UB eyWh+wPX4LU54qI76JviSlNTYbVKPTQw6PRFi8Au7g5M+C4WO/11Kmgru/vZgvoP14wu sXSzmP0fPbMRcVgZZGErWbTRU/BJPJavK/ZAn64JFmsOVo/d0KuBU1MOXiWoPcyArvaE 6rHVI7LrdjuJeHes+80BZgcQwFRMA+yiDeYHDnmNl4REmzgcMjbBiPg0FL3vTeuKbfan uDSQ== X-Received: by 10.180.8.10 with SMTP id n10mr9668672wia.79.1424349987985; Thu, 19 Feb 2015 04:46:27 -0800 (PST) MIME-Version: 1.0 References: <036301d04ba6$1b06cff0$51146fd0$@php.net> Date: Thu, 19 Feb 2015 12:46:27 +0000 Message-ID: To: francois@php.net, Sara Golemon , PHP internals Content-Type: multipart/alternative; boundary=14dae9cc97c811e13f050f705381 Subject: Re: [PHP-DEV] Scalar Type Hints v0.4 From: patrickallaert@php.net (Patrick ALLAERT) --14dae9cc97c811e13f050f705381 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Le Wed Feb 18 2015 at 19:10:08, Fran=C3=A7ois Laupretre = a =C3=A9crit : > > De : Patrick ALLAERT [mailto:patrickallaert@php.net] > > > > The biggest advantage, IMHO, is that you get the exact same result > whether > > you do: > > > > foo((int) $value); > > > > or: > > > > foo($value); > > > > ... whatever the mode you are in. > > Wrong. Parameter parsing rules are much more restrictive than casting > rules. > > Only 'foo((int)'orange')' would (erroneously) succeed. > Francois, I'm very aware of the distinction between cast mechanism and ZPP, but I obviously haven't been clear about the fact that the (conversion|coercion|type juggling|...) reporting configuration I proposed would have to be used in ZPP *AND* casting mechanism (and anywhere else where some conversion applies). With: $value =3D "foo"; foo((int) $value); it is: "(int) $value" that would generate a warning/error depending on the reporting, not while parsing the parameter of function foo(), which would receive an int (0) in this precise case. And this would address the cases: http://example.org/foo.php?id=3D42 http://example.org/foo.php?id=3Dbar foo.php: