Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86030 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17943 invoked from network); 29 Apr 2015 21:24:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2015 21:24:24 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.173 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.214.173 mail-ob0-f173.google.com Received: from [209.85.214.173] ([209.85.214.173:33074] helo=mail-ob0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/13-26317-70C41455 for ; Wed, 29 Apr 2015 17:24:23 -0400 Received: by oblw8 with SMTP id w8so30431878obl.0 for ; Wed, 29 Apr 2015 14:24:20 -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=/wNrWR0g4YTaL2m9yhehmVE6i5BZxwcEWMlwKT7G8r4=; b=Vw5qqJBxz0PKGMAJ13Cxyd09D2TquB3Cxc0oZJnemEVdbVpRd0AC9mqpp1qJKqe8ZM WaQf7T4sN6wDNJH2JHaj1P7JeAZOE4rOoBqmcm/hoYZ3KBd5MXaYoT5wEtvC5HFTT331 /u7AzcR7Zgiw9BBVCgO33uQdBlUljljzP0eYrJUo4jNTofg1z3PUGPTewwR3ExK3LzYA BTePWYCcl7pwgSk0gpGH/E+awhBQq7lmiDd+5lDFxvBeNLA+r7y1ZsaUPH1jRyiIouBt TAX6tXKPogpHcLRv9LKuUOTuKJ/xpMd+EQuRoF16SeGOtX1Y6Ker5dApHQnm+eh9ny6J PPkg== X-Received: by 10.182.27.34 with SMTP id q2mr903955obg.72.1430342659875; Wed, 29 Apr 2015 14:24:19 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.104.196 with HTTP; Wed, 29 Apr 2015 14:23:39 -0700 (PDT) In-Reply-To: <00a501d08263$cda30310$68e90930$@php.net> References: <00a501d08263$cda30310$68e90930$@php.net> Date: Thu, 30 Apr 2015 06:23:39 +0900 X-Google-Sender-Auth: wYOGTvVRzKcss31sFbzAIGiY5ms Message-ID: To: francois Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e013a078c26290a0514e39ae7 Subject: Re: [PHP-DEV] Adding "numeric" type hint From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e013a078c26290a0514e39ae7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Francois, On Wed, Apr 29, 2015 at 7:03 PM, Fran=C3=A7ois Laupretre wrote: > > De : yohgaki@gmail.com [mailto:yohgaki@gmail.com] De la part de Yasuo > > Ohgaki > > > > External data can have any form of numbers. > > Current PHP can handle them as "string". However PHP7's type hint canno= t > > handle numeric data well because it only has "int" and "float" hints. > > > > http://3v4l.org/6J0bZ > > I don't understand the error message. PHP 7 is supposed to accept numeric > strings for 'int'. Is it too big for an int ? In this case, it is a > conversion failure, the error message is wrong and should be replaced. > About 32/64 bit integers, this is another subject that was partially > hidden, as many others, by the STH war. > Allowing any forms of int/float as string(and GMP) for weak mode int/float type hint would be alternative resolution for this issue. I think it's better than "numeric" type hint. It seems current weak/strict type hint difference is - weak: allow conversion, force the type - strict: not allow conversion, force the type If weak mode allows this function foo(int $val) { // $val became "int" if value fits for int // otherwise "integer string" or "gmp" object accepted // anything else is error } issue is resolved. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e013a078c26290a0514e39ae7--