Bug #62895 [Com]: base64_decode fail for very short inputs
| From: | mail at hanicka dot net | Date: | Wed, 22 Aug 2012 19:43:52 +0000 |
| Subject: | Bug #62895 [Com]: base64_decode fail for very short inputs | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172807@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62895&edit=1
ID: 62895
Comment by: mail at hanicka dot net
Reported by: mail at hanicka dot net
Summary: base64_decode fail for very short inputs
Status: Feedback
Type: Bug
Package: URL related
Operating System: Mac OS X 10.8
PHP Version: 5.4.6
Block user comment: N
Private report: N
New Comment:
base64_encode("A") returns "QQ=="
Previous Comments:
------------------------------------------------------------------------
[2012-08-22 16:02:52] laruence@php.net
what is base64_encode("A") outputs?
------------------------------------------------------------------------
[2012-08-22 13:49:27] 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"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62895&edit=1