Bug #73954 [NEW]: NAN check fails on Alpine Linux with musl
| From: | zaq178miami at gmail dot com | Date: | Tue, 17 Jan 2017 08:53:36 +0000 |
| Subject: | Bug #73954 [NEW]: NAN check fails on Alpine Linux with musl | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-206707@lists.php.net to get a copy of this message | ||
From: zaq178miami at gmail dot com
Operating system: Alpine Linux
PHP version: Irrelevant
Package: *General Issues
Bug Type: Bug
Bug description:NAN check fails on Alpine Linux with musl
Description:
------------
It seems to be that is_nan check fails or sth like that as when passing
NAN to as an int parameter it silently casted to int(0). While int(0) is
valid result for explicit (int)NAN cast, according to Andrea
(https://wiki.php.net/rfc/zpp_fail_on_overflow).
As already discussed on SO
(http://chat.stackoverflow.com/transcript/message/35136128#35136128) it
might be just a musl bug, but maybe we should check what NAN do we have
and maybe alter config scripts and/or php_get_nan() accordingly?
Here is runnable snippet: https://3v4l.org/m7hpq
Test script:
---------------
<?php
function test(int $test) {
var_dump($test);
}
test(NAN);
Expected result:
----------------
Fatal error: Uncaught TypeError: Argument 1 passed to test() must be of
the type integer, float given, called in /in/m7hpq on line 6 and defined
in /in/m7hpq:2 Stack trace: #0 /in/m7hpq(6): test(NAN) #1 {main} thrown
in /in/m7hpq on line 2
Actual result:
--------------
int(0)
--
Edit bug report at https://bugs.php.net/bug.php?id=73954&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73954&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73954&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73954&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73954&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73954&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73954&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73954&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73954&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73954&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73954&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73954&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73954&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73954&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73954&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73954&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73954&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73954&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73954&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73954&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73954&r=mysqlcfg