Bug #69188 [Com]: The constant INF is set to float(0)

From: Date: Thu, 15 Dec 2016 11:35:41 +0000
Subject: Bug #69188 [Com]: The constant INF is set to float(0)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206033@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69188&edit=1

 ID:                 69188
 Comment by:         wagner at strato-rz dot de
 Reported by:        manuel at moosnet dot de
 Summary:            The constant INF is set to float(0)
 Status:             Open
 Type:               Bug
 Package:            Math related
 Operating System:   SunOS 5.10
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

We currently have patched our PHP 7 version to determine the value of "INF" correctly.

The problem is that "configure" does not work with Solaris 10 correctly and defines
HAVE_ATOF_ACCEPTS_INF without checking the value of atof(INF).

I have to put in some more work to provide a proper patch for this to php.net. If you are
experiencing this error please switch to PHP 7.


Previous Comments:
------------------------------------------------------------------------
[2016-09-07 16:59:12] chris at chrisjean dot com

@manuel at moosnet dot de

You suggested that the tooling used to provision the servers could be the source of the issue. I
suggest that you dig deeper into that as I ran your sample C code on a fresh install of Solaris 11.3
and did not see a problem. This points to a problem in your provisioning process, not a
compatibility problem with Solaris.

$ uname -a
SunOS solaris 5.11 11.3 i86pc i386 i86pc
$ ./atof
__i386__ Inf
atof: Inf
fract: Inf

------------------------------------------------------------------------
[2016-08-10 15:09:08] tycholursen at gmail dot com

@wagner at strato-rz dot de
Are you aware of the fact that this long standing bug on the Strato servers prevents MediaWiki
version 1.27.0 from functioning?
Please have a look at https://phabricator.wikimedia.org/T139559 for
clarification.
It contains a backtrace of the "ParameterAssertionException: Bad value for parameter maxKeys:
must be above zero" I encountered in an attempt to install MediaWiki 1.27.0 on Strato servers.
Please fix it!

------------------------------------------------------------------------
[2016-07-07 13:19:19] wagner at strato-rz dot de

Just tested it with Solaris 11,
we are seeing the same problem there.

What about my proposed fix ?
(Not defining HAVE_ATOF_ACCEPTS_INF on Solaris machines)

[solaris11 ~]# ./inftest 
__i386__: Inf
atof: 0.000000
fract: Inf
[solaris11 ~]# uname -a
SunOS solaris11 5.11 11.3 i86pc i386 i86pc

Just for clarification, it's not a build breaker,
the is_finite() PHP-function seems to be buggy on 
Solaris.

------------------------------------------------------------------------
[2015-08-26 13:07:40] wagner at strato-rz dot de

Hi, 

I am a developer at strato.
It seems that the problem is
with SUN Solaris 5.10.

I found that the code in ext/standard/basic_functions.c: php_get_inf()
uses atof to determine the value of "INF".

To test the matter I wrote a test what "INF" would be
if php uses a different way to determine the value

------------------------------------------------
CODE:
------------------------------------------------
int main(void) 
{
	#define PHP_DOUBLE_INFINITY_HIGH       0x7ff00000

	double val = 0.0;
	((uint32_t*)&val)[1] = PHP_DOUBLE_INFINITY_HIGH;
	((uint32_t*)&val)[0] = 0;
	printf("__i386__: %f\n",val);

	double atf = atof("INF");
	printf("atof: %f\n",atf);

	printf("fract: %f\n",1.0/0.0);
	
	return 0;
}
------------------------------------------------
OUTPUT:
------------------------------------------------
__i386__: Inf
atof: 0.000000
fract: Inf
------------------------------------------------

This shows that using atof() for "INF" does not work
as expected and it is not server specific but a problem
in the Solaris OS (5.10) itself.

Never the less, the other methods php could use would result
in a correct value.

Defining HAVE_ATOF_ACCEPTS_INF on Solaris 5.10 seems wrong
at first, although its a strange behaviour by the OS.

Maybe there is something wrong with autotools we are using,
that are an older version.

I will investigate some more and write down my results here

------------------------------------------------------------------------
[2015-08-25 12:54:39] fisharebest at gmail dot com

One of users (also a strato.de customer) has reported the same issue, across a range of PHP
versions.

I have just built a SunOS 11.2 server and compiled PHP from source.

It works as expected.

This suggests the problem is specific to servers at strato.de.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=69188


--
Edit this bug report at https://bugs.php.net/bug.php?id=69188&edit=1


Thread (11 messages)

« previous php.bugs (#206033) next »