php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62895 base64_decode fail for very short inputs
Submitted: 2012-08-22 13:49 UTC Modified: 2013-02-18 00:35 UTC
From: mail at hanicka dot net Assigned:
Status: No Feedback Package: URL related
PHP Version: 5.4.6 OS: Mac OS X 10.8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
18 - 3 = ?
Subscribe to this entry?

 
 [2012-08-22 13:49 UTC] mail at hanicka dot net
Description:
------------
base64_decode fails with only one char encoded in base64,

this bug only occurs on Mac OS X (10.7 and 10.8, only versions I currently have 
available)

bug is in PHP in Mac OS X and in actual version from php.net (5.4.6)

I tryied compile with gcc & clang.

Test script:
---------------
<?php 
echo base64_decode(base64_encode("A"))."\n";
?>


Expected result:
----------------
<?php echo base64_decode(base64_encode("A"))."\n"; ?>

must returns "A"

<?php echo base64_decode(base64_encode("C"))."\n"; ?>

must returns "C"


Actual result:
--------------
<?php echo base64_decode(base64_encode("A"))."\n"; ?>

returns "AD"

<?php echo base64_decode(base64_encode("C"))."\n"; ?>

returns "CD"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-22 16:02 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2012-08-22 16:02 UTC] laruence@php.net
what is base64_encode("A") outputs?
 [2012-08-22 19:43 UTC] mail at hanicka dot net
base64_encode("A") returns "QQ=="
 [2012-08-22 20:54 UTC] rasmus@php.net
That looks correct. So you are saying that base64_decode("QQ==") returns "AD" ?
I really don't see how that is possible.
 [2013-02-18 00:35 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 00:01:30 2024 UTC