NAN/INF->int conversion in 5.6
| From: | Stanislav Malyshev | Date: | Sun, 28 Jun 2015 00:46:02 +0000 |
| Subject: | NAN/INF->int conversion in 5.6 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-86922@lists.php.net to get a copy of this message | ||
Hi!
Working on cleaning up the spec, I've discovered that in PHP 5.6 and
below conversion of NAN to int produces unexpected result of
-9223372036854775808 (on 64-bit, 32-bit probably different). In PHP 7,
it produces expected 0. See e.g.: http://3v4l.org/RKQuu
Same weirdness is for INF and -INF which sometimes produce 0 (e.g. on my
local machine) and sometimes -9223372036854775808 - e.g.
http://3v4l.org/ivX1D
My question is: should we backport code from PHP 7 that checks for
infinity/nan and put it into 5.6? Or it's not worth it and it's ok for
5.6 to return random weird stuff there? (I know it's not exactly random
and there's a reason why it's that number but it looks that way).
--
Stas Malyshev
smalyshev@gmail.com