Bug #72264 [Opn]: base64_decode $strict fails with whitespace between padding
| From: | lauri dot kentta at gmail dot com | Date: | Tue, 14 Jun 2016 15:20:46 +0000 |
| Subject: | Bug #72264 [Opn]: base64_decode $strict fails with whitespace between padding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201610@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72264&edit=1
ID: 72264
User updated by: lauri dot kentta at gmail dot com
Reported by: lauri dot kentta at gmail dot com
Summary: base64_decode $strict fails with whitespace between
padding
Status: Open
Type: Bug
Package: Strings related
PHP Version: 7.0.6
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2016-06-14 13:14:20] cmb@php.net
In my opinion, this is not a bug, but rather expected behavior[1]:
| Returns FALSE if input contains character from outside the
| base64 alphabet.
[1] <http://php.net/manual/en/function.base64-decode.php>
------------------------------------------------------------------------
[2016-05-25 18:55:23] 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)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72264&edit=1