php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39412 base64_decode does not return FALSE on failure
Submitted: 2006-11-07 10:01 UTC Modified: 2006-11-07 14:45 UTC
From: phpbugs at staznosti dot sk Assigned:
Status: Closed Package: *URL Functions
PHP Version: 4.4.4 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: phpbugs at staznosti dot sk
New email:
PHP Version: OS:

 

 [2006-11-07 10:01 UTC] phpbugs at staznosti dot sk
Description:
------------
base64_decode does not return FALSE on failure, return garbled (binary) text instead

Reproduce code:
---------------
$string="This is short string!";

$test=base64_decode($string);

if ($test===FALSE) echo 'text is not base64 encoded';
else echo $test;

Expected result:
----------------
FALSE should be returned

Actual result:
--------------
garbled text / binary string

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-07 14:20 UTC] bjori@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

Will not get fixed in 4.4, but already fixed in 5.2.

php -r 'var_dump(base64_decode("This is short string!", 
true));'
bool(false)
 [2006-11-07 14:45 UTC] phpbugs at staznosti dot sk
I think this should get fixed in 4.x branch, too, as many people don't want (you can guess why - incompatiblity 4.x/5.x is the thing) or are not able to switch.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 08:01:35 2025 UTC