[RFC] Warn about invalid strings in arithmetic

php.internals

Andrew Faulds

10 years ago
Hi everyone, I'm proposing a new RFC to make it easier to spot errors when using PHP's arithmetic operators: https://wiki.php.net/rfc/invalid_strings_in_arithmetic Please read it and tell me your thoughts. Thanks!
-- Andrea Faulds https://ajf.me/

François Laupretre

10 years ago
Hi Andrea, Le 08/01/2016 01:03, Andrea Faulds a écrit :
> Hi everyone, > > I'm proposing a new RFC to make it easier to spot errors when using > PHP's arithmetic operators: > > https://wiki.php.net/rfc/invalid_strings_in_arithmetic > > Please read it and tell me your thoughts. > > Thanks!
I would suggest we still accept leading and trailing blanks without E_NOTICE. That's easy to implement (leading blanks are already accepted and adding non-blank trailing char detection is trivial) and would greatly reduce BC breaks. Regards François

Andrew Faulds

10 years ago
Hi François, François Laupretre wrote:
> I would suggest we still accept leading and trailing blanks without > E_NOTICE. That's easy to implement (leading blanks are already accepted > and adding non-blank trailing char detection is trivial) and would > greatly reduce BC breaks.
Leading whitespace is already accepted by zend_is_numeric_string, the problem is trailing whitespace. While that could be changed, it also affects function parameter and return type checks, so I don't know if it's within the scope of this RFC. Thanks.
-- Andrea Faulds https://ajf.me/