|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-05-25 18:55 UTC] lauri dot kentta at gmail dot com
Description:
------------
base64_decode $strict fails with whitespace between padding.
Test script:
---------------
<?php
var_dump(base64_decode("VV= =", true));
Expected result:
----------------
string(1) "U"
Actual result:
--------------
bool(false)
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 16:00:01 2025 UTC |
Whitespace (at least line breaks) is allowed in Base64. And even with your logic, at least the whitespace should be handled equally in all cases. In other words, base64_decode("VV ==") and base64_decode("VV= =") should yield the same result.> Whitespace (at least line breaks) is allowed in Base64. Line breaks are allowed, but as far as I know, not in arbitrary places, and no other whitespace characters are allowed. > In other words, base64_decode("VV ==") and base64_decode("VV= > =") should yield the same result. ACK. Obviously that is not the case now: <https://3v4l.org/4ZV7T>.