|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2014-09-22 02:01 UTC] wzis at hotmail dot com
 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 16:00:01 2025 UTC | 
String lengths in PHP are not determined by a null character. You can easily test this for yourself. If they were, then this should print the same base64 encoded string twice: echo base64_encode("abc\0def"); echo "\n"; echo base64_encode("abc"); It doesn't, of course.