Bug #68068 [NEW]: base64_encode should take byte streams and a length
From: wzis at hotmail dot com
Operating system: UNIX/Linux
PHP version: Irrelevant
Package: hash related
Bug Type: Bug
Bug description:base64_encode should take byte streams and a length
Description:
------------
---
From manual page: http://www.php.net/function.base64-encode
---
base64_encode now only takes one str argument, that will make conversion
of a byte stream with \0 in it fail, so can't convert arbitrary byte
stream properly.
Test script:
---------------
$randv=shell_exec("dd if=/dev/urandom bs=1 count=6 2>/dev/null");
$salt="\$1\$".base64_encode($randv);
Expected result:
----------------
$salt="\$1\$".base64_encode($randv, 6);
Actual result:
--------------
depends on what we get from the /dev/urandom, the $salt could be shorter
than 8 characters as it supposed to be.
--
Edit bug report at https://bugs.php.net/bug.php?id=68068&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68068&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68068&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68068&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68068&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68068&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68068&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68068&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68068&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68068&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68068&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68068&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68068&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68068&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68068&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68068&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68068&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68068&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68068&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68068&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68068&r=mysqlcfg
Thread (3 messages)
- wzis at hotmail dot com