Bug #76884 [NEW]: base_convert restore data not equal origin data
| From: | aston dot seal at gmail dot com | Date: | Sat, 15 Sep 2018 03:24:51 +0000 |
| Subject: | Bug #76884 [NEW]: base_convert restore data not equal origin data | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217061@lists.php.net to get a copy of this message | ||
From: aston dot seal at gmail dot com
Operating system: centos 7.4
PHP version: 7.2.10
Package: *General Issues
Bug Type: Bug
Bug description:base_convert restore data not equal origin data
Description:
------------
---
From manual page: http://www.php.net/function.base-convert
---
PHP Version : PHP 7.2.10 (cli) (built: Sep 11 2018 10:09:51) ( NTS )
when I using base_convert to make a order id for my system, I found it
restore my data isn't correct, is it a bug ?
origin_data always not equal recovery_data
Test script:
---------------
$a = '10010'.sprintf('%02d',mt_rand(0,99)).str_pad(str_replace('.',
'',
microtime(TRUE)), 14, 0, STR_PAD_RIGHT);
echo 'origin_data : '.$a;
echo '<br>';
$b = base_convert($a, 10,36);
echo 'convert_data : '.$b;
echo '<br>';
echo 'recovery_data : '.base_convert($b, 36,10);
Expected result:
----------------
origin_data : 100106615369813329847
convert_data : l4k9ti8ikb4cg
recovery_data : 100106615369813329847
Actual result:
--------------
origin_data : 100106615369813329847
convert_data : l4k9ti8ikb4cg
recovery_data : 100106615369813328882
--
Edit bug report at https://bugs.php.net/bug.php?id=76884&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76884&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76884&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76884&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76884&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76884&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76884&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76884&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76884&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76884&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76884&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76884&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76884&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76884&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76884&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76884&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76884&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76884&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76884&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76884&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76884&r=mysqlcfg