#44092 [NEW]: exp() function returns incorrect result if passed hex
| From: | zoe@php.net | Date: | Sun, 10 Feb 2008 17:20:21 +0000 |
| Subject: | #44092 [NEW]: exp() function returns incorrect result if passed hex | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-122152@lists.php.net to get a copy of this message | ||
From: zoe@php.net
Operating system: Linux 32
PHP version: 5.3CVS-2008-02-10 (CVS)
PHP Bug Type: *Math Functions
Bug description: exp() function returns incorrect result if passed hex
Description:
------------
In PHP5.3 is a hex string is passed to exp() it is interpreted as 0 and
the result of exp(0) = 1 is returned.
In PHP6 the hex string is correctly interpreted and the corrcet value is
returned by exp().
I believe the PHP6 behaviour is preferred.
This patch http://www.pastebin.ca/898812 corrects the
PHP5.3 behaviour.
Reproduce code:
---------------
--TEST--
Test exp() - pass exp hex string
--INI--
precision=14
--FILE--
<?php
$value= "0x5F";
$res = exp($value);
var_dump($res);
?>
--EXPECTF--
float(1.811239082889E+41)
Expected result:
----------------
See above
Actual result:
--------------
1
--
Edit bug report at http://bugs.php.net/?id=44092&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=44092&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44092&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44092&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44092&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44092&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44092&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44092&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44092&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44092&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44092&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44092&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44092&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44092&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44092&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=44092&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=44092&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44092&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44092&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44092&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44092&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44092&r=mysqlcfg