#45415 [Opn->Fbk]: function "base_convert" bugs
| From: | jani@php.net | Date: | Wed, 02 Jul 2008 11:59:28 +0000 |
| Subject: | #45415 [Opn->Fbk]: function "base_convert" bugs | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126199@lists.php.net to get a copy of this message | ||
ID: 45415
Updated by: jani@php.net
Reported By: aurorakay at yeah dot net
-Status: Open
+Status: Feedback
-Bug Type: *Math Functions
+Bug Type: Math related
Operating System: Linux 2.6.23-tuxonice-r10-
PHP Version: 5.2.6
New Comment:
Exactly what is the expected and what is the actual results?
Previous Comments:
------------------------------------------------------------------------
[2008-07-02 11:54:26] aurorakay at yeah dot net
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 this bug report at http://bugs.php.net/?id=45415&edit=1