#22173 [Opn->Bgs]: Strange behaviour with the string 'inf'
| From: | iliaa@php.net | Date: | Tue, 11 Feb 2003 23:11:21 +0000 |
| Subject: | #22173 [Opn->Bgs]: Strange behaviour with the string 'inf' | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-32838@lists.php.net to get a copy of this message | ||
ID: 22173
Updated by: iliaa@php.net
Reported By: afenoy@wol.es
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.2.1
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2003-02-11 13:55:05] afenoy@wol.es
Very strange bug: (double) of any string begining with 'inf' evaluates
as 'INF', but only in strings of more than 3 characters a comparison
with a integer results in same bug.
Try this script:
<?
echo 'somestring' > 1 ? 1 : 0, '<br>';
echo 'inf' > 1 ? 1 : 0, '<br>';
echo 'info' > 1 ? 1 : 0, '<br>';
echo 'inf at begin' > 1 ? 1 : 0, '<br>';
echo (double)'somestring', '<br>';
echo (double)'inf', '<br>';
echo (double)'inf at begin', '<br>';
?>
Expected results are:
0
0
0
0
0
0
0
But real results are:
0
0
1
1
0
INF
INF
Saludos
Àngel
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22173&edit=1