|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-10-12 14:24 UTC] klewi1983 at wp dot pl
Description:
------------
XAMPP 5.6.31 32bit:
PHP 5.6.31 (cli) (built: Jul 5 2017 22:25:43)
XAMPP 7.2.10, both 32 bit:
PHP 7.2.10 (cli) (built: Sep 13 2018 01:01:10) ( ZTS MSVC15 (Visual C++ 2017) x86 )
My test file (test.bin) size is 123 KB.
How can I attach it to the bug?
Test script:
---------------
var_dump(base64_decode(file_get_contents("test.bin")));
Expected result:
----------------
string(0) ""
Actual result:
--------------
result in PHP 5.6.31:
string(0) ""
result in PHP 7.2.10:
string(22534) "Yt yeN)O?←┬ÁuAŞČ7L...............
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 17:00:01 2025 UTC |
Thanks! The “new” behavior is correct according to the documentation; since $strict is FALSE, invalid Base64 characters are silently discarded. The following script confirms this: <?php $data = file_get_contents("test.bin"); $stripped = preg_replace('/[^A-Za-z0-9+\/]/', '', $data); var_dump(base64_decode($data) === base64_decode($stripped, true));