php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72152 base64_decode $strict fails to detect null byte
Submitted: 2016-05-04 10:26 UTC Modified: 2016-05-06 14:56 UTC
From: vedad at kajtaz dot net Assigned:
Status: Closed Package: *URL Functions
PHP Version: 7.0.6 OS: FreeBSD 10.1
Private report: No CVE-ID: None
 [2016-05-04 10:26 UTC] vedad at kajtaz dot net
Description:
------------
As per documentation,

base64_decode("\x0", true)
base64_decode("\x0anything", true)

shoud return FALSE. Instead, they return an empty string.


Test script:
---------------
var_export(base64_decode("\x0", true));
echo PHP_EOL;
var_export(base64_decode("\x0anything", true));


Expected result:
----------------
false
false

Actual result:
--------------
''
''

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-06 14:56 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2016-05-06 14:56 UTC] cmb@php.net
Obviously, base64_decode(..., true) is not binary safe,
see <https://3v4l.org/H9shC>.
 [2016-07-05 14:57 UTC] nikic@php.net
Automatic comment on behalf of lauri.kentta@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=260c07db850266d2d65cff446ec98d4a4752d41c
Log: base64_decode: fix bug #72152 (fail on NUL bytes in strict mode)
 [2016-07-05 14:57 UTC] nikic@php.net
-Status: Verified +Status: Closed
 [2016-07-06 05:47 UTC] davey@php.net
Automatic comment on behalf of lauri.kentta@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=260c07db850266d2d65cff446ec98d4a4752d41c
Log: base64_decode: fix bug #72152 (fail on NUL bytes in strict mode)
 [2016-07-06 23:33 UTC] nikic@php.net
Automatic comment on behalf of lauri.kentta@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b9c9be13ccbf48c02ad01e19f4fce20c104a003e
Log: base64_decode: fix bug #72152 (fail on NUL bytes in strict mode)
 [2016-07-20 11:30 UTC] davey@php.net
Automatic comment on behalf of lauri.kentta@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b9c9be13ccbf48c02ad01e19f4fce20c104a003e
Log: base64_decode: fix bug #72152 (fail on NUL bytes in strict mode)
 [2016-07-20 11:30 UTC] davey@php.net
Automatic comment on behalf of lauri.kentta@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=260c07db850266d2d65cff446ec98d4a4752d41c
Log: base64_decode: fix bug #72152 (fail on NUL bytes in strict mode)
 [2016-10-17 10:11 UTC] bwoebi@php.net
Automatic comment on behalf of lauri.kentta@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b9c9be13ccbf48c02ad01e19f4fce20c104a003e
Log: base64_decode: fix bug #72152 (fail on NUL bytes in strict mode)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC