#45415 [NEW]: function "base_convert" bugs
From: aurorakay at yeah dot net
Operating system: Linux 2.6.23-tuxonice-r10-
PHP version: 5.2.6
PHP Bug Type: *Math Functions
Bug description: function "base_convert" bugs
Description:
------------
the same data,but at e.g.1,I convert hex to dec. The value is my wish, at
e.g.2 I convert dec to hex. The value isn't my wish.
Reproduce code:
---------------
/*e.g.1*/
$flag=1<<29;
$mark="0x808080";
$mark=base_convert($mark,16,10);
$flag=$flag | $mark;
$t=(base_convert($flag,10,2));
/* this will print "string(30) "100000100000001000000010000000" */
var_dump($t);
/*e.g.2*/
$flag1=1<<29;
$mark1="0x808080";
$flag1=base_convert($flag1,10,16);
$flag1=$flag1 | $mark1;
$t1=(base_convert($flag1,16,2));
/* this will print "string(26) "10100000001000000010000000" */
var_dump($t1);
Expected result:
----------------
/*e.g.1*/ is my wish.
Actual result:
--------------
e.g.1 print "string(30) "100000100000001000000010000000";
e.g.2 print "string(26) "10100000001000000010000000"
--
Edit bug report at http://bugs.php.net/?id=45415&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45415&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45415&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45415&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45415&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45415&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45415&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45415&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45415&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45415&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45415&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45415&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45415&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45415&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45415&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45415&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45415&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45415&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45415&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45415&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45415&r=mysqlcfg
Thread (4 messages)
- aurorakay at yeah dot net