ID: 36946
User updated by: kirlo at gmx dot de
Reported By: kirlo at gmx dot de
-Status: Feedback
+Status: Open
Bug Type: *URL Functions
Operating System: windows & debian
PHP Version: 5.1.2
New Comment:
yes, we've already tried urlencoding as an alternative and urldecode
works.
but there's still the base64_decode bug when you send the data via POST
or GET.
as i mentioned before, it worked under php4 and the earlier php5
versions.
Previous Comments:
------------------------------------------------------------------------
[2006-04-02 13:08:42] [EMAIL PROTECTED]
What if you use urlencode($data) ?
------------------------------------------------------------------------
[2006-04-02 12:10:02] kirlo at gmx dot de
well that's mysterious - this script will work without any problems
(put my base64encoded.txt into the scriptdir):
<?php
$fp = fopen ("base64encoded.txt", "r");
$str = fread ($fp, filesize ("base64encoded.txt"));
fclose ($fp);
echo base64_decode($str);
?>
but if you send the string via POST or GET, you'll get this output,
where the text ist messed up (copy the content of base64encoded.txt and
put it behind yourscript.php?vari= ):
<?php
echo base64_decode($_GET[vari]);
?>
------------------------------------------------------------------------
[2006-04-02 11:51:10] [EMAIL PROTECTED]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2006-04-02 10:49:24] kirlo at gmx dot de
Description:
------------
we're encoding some text data with base64 with a small application (not
php) on a client pc, then we'll send it to a webserver via POST or GET.
the PHP script is fetching POST or GET without any problems but it does
not correctly perform the base64_decode operation. we checked our base64
encoded text with other tools (for example
http://makcoder.sourceforge.net/demo/base64.php ) and they had no
problems!
this system works with the latest php4 version but it does not work
with the latest php5 version (on the earlier version it also worked
well!). i already tried the latest CVS snapshot but it didn't worked
either.
Reproduce code:
---------------
very simple:
echo base64_decode($_POST[base64text]);
Expected result:
----------------
here are three files
the original text:
http://t-man.isr-clan.ath.cx/phpbugreport/original.txt
the base64 encoded text (base64 encoding performed by our client
application):
http://t-man.isr-clan.ath.cx/phpbugreport/base64encoded.txt
the base64_decode output:
http://t-man.isr-clan.ath.cx/phpbugreport/base64_decode-output.txt
in this case the messed up text is at the end of the text. sometimes
the messed up text is starting at the first 2 or 3 lines.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36946&edit=1