ID: 22173
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Verified
+Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.3.1-dev
New Comment:
This bug is the result of differing implementations of strtod() in the
various libc libraries. For example glibc considers (double) "info" to
be equivalent to INF while in Win32 the same operation will return 0.
Previous Comments:
------------------------------------------------------------------------
[2003-02-12 22:02:44] [EMAIL PROTECTED]
verified with PHP 4.3.1-dev..
------------------------------------------------------------------------
[2003-02-12 12:46:21] [EMAIL PROTECTED]
We're already discussing this - so reopening was valid.
------------------------------------------------------------------------
[2003-02-12 05:16:36] [EMAIL PROTECTED]
Re-open: at least with single three characters 'inf', this is a bug and
not a 'functionality'.
------------------------------------------------------------------------
[2003-02-12 04:38:17] [EMAIL PROTECTED]
Ok, double-checked the documentation: this behavior of 'inf...' strings
seems absolutely undocumented.
Auto-convertion of any string that begins by 'inf' in infinite seems to
me inadequate. Considering that this 'functionality' has not been
documented, would be desirable to create a new predefined constant INF
or a new data type INF or a new reserved word INF to treat infinite
numbers, in the same form in which NULL, TRUE or FALSE correspond to
predefined values. Consider that when we locked up 'NULL', 'TRUE' or
'FALSE' in a string, they are not evaluated like the corresponding
constants. The same behavior would be desirable with a (new) predefined
constant INF.
And at least an error exists now in the form in which the strings that
begin by 'inf' are treated. The strings of more than 3 characters
('information', 'infant' ...) are evaluated as INF in the comparisons
with numbers, but the string 'inf', with single three characters, does
not. Try this:
<?
echo (double)'information', '<br>';
echo (double)'inf' , '<br>';
echo 'information' > 1 ? 1 : 0, '<br>';
echo 'inf' > 1 ? 1 : 0, '<br>';
?>
Result:
INF
INF
1
0
Saludos
�ngel
------------------------------------------------------------------------
[2003-02-11 17:11:20] [EMAIL PROTECTED]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
When performing a mathematical calculation between a number and a
string in PHP, PHP will attempt to convert the string to an integer.
Since PHP supports things such as INF certain strings, such as 'inf
more data' will be converted to INF.
------------------------------------------------------------------------
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
http://bugs.php.net/22173
--
Edit this bug report at http://bugs.php.net/?id=22173&edit=1