ID:               31889
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Closed
 Bug Type:         Unknown/Other Function
 Operating System: Linux
 PHP Version:      4.3.10
 New Comment:

Just for information's sake, this bug came up because Oracle (at least
the version we're using) returns NUMBER columns in this range without a
leading 0.


Previous Comments:
------------------------------------------------------------------------

[2005-02-09 00:07:47] [EMAIL PROTECTED]

Fixed in snapshot -> closed.

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

[2005-02-09 00:04:40] [EMAIL PROTECTED]

Ok, you're right, my code is broken, I should have (float) instead of
(int). Stupid me. And that fixes that code. 

However, consider this code:

$str = '-.55';
$num = $num2 = 0;
$num += $str;
$num2 += (float)$str;
echo $str."\n".(float)$str."\n".$num."\n".$num2."\n";

This outputs:
-.55
-0.55
0
-0.55

But should output:
-.55
-0.55
-0.55
-0.55


The snapshot fixes this, thanks.

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

[2005-02-08 23:37:10] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

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

[2005-02-08 23:35:11] [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

read your code again

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

[2005-02-08 22:49:30] [EMAIL PROTECTED]

Description:
------------
A string which holds a number which is less than 0 but greater than -1
and does not have a leading 0, is not converted to a number correctly,
it comes back as 0.

Reproduce code:
---------------
$str = '-.55';
echo $str."\n".(int)$str;

Expected result:
----------------
-.55
-.55

Actual result:
--------------
-.55
0


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


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

Reply via email to