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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 21:01:31 2024 UTC