Am 16.07.2020 um 16:18 schrieb G. P. B. <george.bany...@gmail.com>:
> I've opened voting for the Saner Numeric strings RFC:
> https://wiki.php.net/rfc/saner-numeric-strings

Looking at the BC section I stumbled across

> Code relying on the fact that '' (an empty string) evaluates to 0 for 
> arithmetic/bitwise operations.


which is elaborated further down as

> The third reason already emitted an E_WARNING. We considered special-casing 
> this to evaluate to 0, but this would be inconsistent with how type 
> declarations deal with an empty string, namely throwing a TypeError. 
> Therefore a TypeError will also be emitted in this case. The error can be 
> avoided by explicitly checking for an empty string and changing it to 0.


but now I'm a bit confused what is meant by "arithmetic/bitwise operations".

I assume this applies only to things like substr("foo", "") but not to 
arithmetic *operators* like 42 + "" because that doesn't currently trigger 
E_WARNING AFAIK.
Maybe this should be clarified?

Regards,
- Chris

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to