Le Wed Feb 18 2015 at 18:35:02, François Laupretre <franc...@php.net> a
écrit :

> > De : Patrick ALLAERT [mailto:patrickalla...@php.net]
> >     ini_set("coercion_reporting", COERCION_ERROR); // Fail in case of
> > potentially bad coercion
> >
> >     foo(7);
> >     // int(7)
> >     foo("7");
> >     // int(7)
> >     foo("7 dogs");
> >     // Catchable fatal error: Unsafe coercion transforming "7 dogs" to
> "7".
> >
> > 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.
> >
> > Basically, this is weak type hints + something similar to what I
> > contributed in the past with the "Array to string conversion" notice
> (see:
> > https://github.com/php/php-src/commit/d81ea16e).
> >
> > Care to share the pro's/con's you see with a solution like that?
>
> That's a good idea, IMO. We can add an optional message when a conversion
> is executed in ZPP macros. It can help. The main drawback is that it is
> pure runtime check, not suitable for static analysis and related tools.
>

Does it sounds like a "compromise"? ;)

More seriously, I'm not sure that should be a prerequisite for accepting an
RFC.

Patrick

Reply via email to