Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86054 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62203 invoked from network); 30 Apr 2015 01:25:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2015 01:25:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.176 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.214.176 mail-ob0-f176.google.com Received: from [209.85.214.176] ([209.85.214.176:35351] helo=mail-ob0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/B6-29050-37481455 for ; Wed, 29 Apr 2015 21:25:09 -0400 Received: by obcux3 with SMTP id ux3so33628421obc.2 for ; Wed, 29 Apr 2015 18:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=0HMzJfjq67kGoBzysRyst18aXD/kmfbILF2yxYC0HVU=; b=uchyYOt7E82SFbPhN/cWhCCc+GnhLh+KkJZMYnx+weTzaNVm9huY7QU3iQ4aYHoSJD 8vEjmg4fp12kAgHcGtWQ+JlugwAF/DJ1TckMjgfDWCkrAiinzzfqHEKFqKwBRlLxlean itMj7k0dhskGstSVBXPCaS9dQZhbXi16IqlKVAU8aa/dFJLqB7b8tcJvz7gSrwNoQ76h 51V/0vLVUpgazhRmGGbPaPiWPzmW/mCkmKiTAhGLPyTsyqDraQy4cBIw/usSDi9hV4ch z00osplwuguPfvsrWYzaTz9X5b1pRXx69l6edILnDI50+io3EPVD7NgUP9YZx1sy2wBm 5mvQ== X-Received: by 10.182.68.103 with SMTP id v7mr1492201obt.82.1430357104389; Wed, 29 Apr 2015 18:25:04 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.104.196 with HTTP; Wed, 29 Apr 2015 18:24:23 -0700 (PDT) In-Reply-To: <554176D6.2030007@gmx.de> References: <55401F31.9030703@gmail.com> <55416849.9010808@gmail.com> <554176D6.2030007@gmx.de> Date: Thu, 30 Apr 2015 10:24:23 +0900 X-Google-Sender-Auth: ijY5YuqQ4uxkiJAHziYizr8xLG4 Message-ID: To: Christoph Becker Cc: Stanislav Malyshev , Ryan Pallas , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=e89a8fb1ef2c1bf4dc0514e6f736 Subject: Re: [PHP-DEV] Adding "numeric" type hint From: yohgaki@ohgaki.net (Yasuo Ohgaki) --e89a8fb1ef2c1bf4dc0514e6f736 Content-Type: text/plain; charset=UTF-8 Hi Christoph, On Thu, Apr 30, 2015 at 9:27 AM, Christoph Becker wrote: > > On Thu, Apr 30, 2015 at 8:24 AM, Stanislav Malyshev > > > wrote: > > > >> PHP types are not machine native types. But yes, it forces PHP type - > >> that's why it is *type* check. > > > > Type hint is better to stay as "hint" under weak mode. IMO. > > "Type hints" have never been hints. The wording is a misnomer. Try to > pass an int to a parameter declared as array, for instance. > I understand how it worked and how it will. "hint" sounds a little misleading. Since we named it already, we may follow the semantics. > > >> You are saying type checking which produces fatal errors does not match > >> your use case. OK, I can sympathize, but how introducing more > >> pseudo-types helps? You just fix one narrow use case that you have right > >> now while leaving the problem still in the same place. That's not a good > >> way to address it. > > > > I'm not concerning myself, but I'm worrying about users to write > > apps/libraries > > that can cause DoS easily. I don't want to see my my apps emit fatal > error > > by upgrading library just because library author decided to use type hint > > wrongly. > > A fatal error wouldn't constitute a DoS vulnerability, would it? > Attacker may inject huge ID value and/or they may simply access web sites to reach 2 billion limit, for example. > > > BTW, GMP integer is already integrated into PHP why not treat GMP as int? > > It's type "hint", isn't it? > > The basic idea of the STHs is to guarantee that the value is of the > respective type inside the function (parameter type "hints") resp. the > return value (return value type "hints") has the respective type. > > Accepting GMP for int just won't fit to this definition -- or it would > lead to a potentially considerable data loss. I mean accept GMP as PHP int in weak mode as it is, not converting C int. Strictly speaking GMP has its type, but it can be used as "string integer" now. i.e. $gmp_int_a + $gmp_int_b works just like $str_int_a + $str_int_b. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --e89a8fb1ef2c1bf4dc0514e6f736--