#48573 [NEW]: E-notated strings improperly cast as integers
| From: | josh at mykoala dot com | Date: | Tue, 16 Jun 2009 19:08:11 +0000 |
| Subject: | #48573 [NEW]: E-notated strings improperly cast as integers | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-138372@lists.php.net to get a copy of this message | ||
From: josh at mykoala dot com
Operating system: Mac OS X 10.5.7
PHP version: 5.2.9
PHP Bug Type: *Programming Data Structures
Bug description: E-notated strings improperly cast as integers
Description:
------------
When an E notated integer is in a string, and you try to cast it to an
integer, the value stops at anything non-integer, reducing the ability to
cast notated numbers. It does not first check or convert the value to a
float to account for E notation.
The documentation on type juggling doesn't mention this limitation, and it
is not the expected result.
Reproduce code:
---------------
$ php -r 'var_dump((int)"5.6401418785e+05");'
int(5)
$ php -r 'var_dump((int)5.6401418785e+05);'
int(564014)
$ php -r 'var_dump((int)(float)"5.6401418785e+05");'
int(564014)
--
Edit bug report at http://bugs.php.net/?id=48573&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48573&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48573&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48573&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48573&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48573&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48573&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48573&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48573&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48573&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48573&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48573&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48573&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48573&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48573&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48573&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48573&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48573&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48573&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48573&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48573&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48573&r=mysqlcfg