|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2017-02-03 06:26 UTC] bugs dot php dot net at chsc dot dk
 Description: ------------ is_infinite() is broken in the PHP binary included in Alpine Linux. It returns TRUE for is_infinite(INF), but FALSE for is_infinite(-INF). Test script: --------------- var_dump(is_infinite(-INF)); Expected result: ---------------- bool(true) Actual result: -------------- bool(false) PatchesPull Requests
Pull requests: 
 HistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 14:00:01 2025 UTC | 
Does #include <math.h> #ifndef isfinite # error Not defined #endif void main() {} compile for you? This seems pretty weird, because glibc should have isfinite().The C example code does not compile on CentOS 5: georgi@cent5:~$ cat > z.c #include <math.h> #ifndef isfinite # error Not defined #endif void main() {} georgi@cent5:~$ gcc z.c z.c:3:3: error: #error Not defined z.c: In function ‘main’: z.c:5: warning: return type of ‘main’ is not ‘int’ georgi@cent5:~$ rpm -qa | grep glibc | sort | uniq glibc-2.5-58.el5_6.3 glibc-common-2.5-58.el5_6.3 glibc-devel-2.5-58.el5_6.3 glibc-headers-2.5-58.el5_6.3$ man isfinite says that isfinite() is a C99 feature. In order to see what's going on compiler diagnostics helps (please note that the return type of main is int according to all known standards): main.c ------ #include <stdio.h> #include <math.h> int main() { double d = 0; printf ("%d\n", isfinite (d)); return 0; } ------ $ gcc -Wall -Werror main.c cc1: warnings being treated as errors main.c: In function 'main': main.c:7: error: implicit declaration of function 'isfinite' The default mode of GCC is C99 since GCC 5, before it was C89. For those older compilers you have to explitly switch C99-mode on: $ gcc -Wall -Werror -std=c99 main.c The reason why there is an linker error is that for the implicitly declared isfinite() the symbol is the object file and the symbol used in the libc is not "isfinite" but here on my machine "__finite": $ nm main.o U __finite 0000000000000000 T main U printf