Hi Francois,

On Wed, Apr 29, 2015 at 7:03 PM, François Laupretre <franc...@php.net>
wrote:

> > De : yohg...@gmail.com [mailto:yohg...@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 cannot
> > 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
yohg...@ohgaki.net

Reply via email to