From: sadun at isikun dot edu dot tr
Operating system: windows server 2003
PHP version: 4CVS-2003-09-02 (stable)
PHP Bug Type: *URL Functions
Bug description: base64_decode returns 0
Description:
------------
working code on 4.3.3 version wont work on php 4.3.4-dev.
code at the bottom, i checked that $attach_content[1] is not empty also
with healty base64 encoding.
Reproduce code:
---------------
if($fp){
$attach_content = fread($fp,filesize($attachment_file));
fclose($fp);
$attach_content = explode("EXPLODE_FROM_HERE",$attach_content);
$attach_info = explode("~~",$attach_content[0]);
$content_type = trim($attach_info[0]);
$content_type = ereg_replace(";", "", $content_type);
header("Content-transfer-encoding: binary\n");
header("Content-Disposition: attachment;
filename=$HTTP_GET_VARS[name]\n");
if($attach_info[1]=="base64"){
echo base64_decode($attach_content[1]);
}
if($attach_info[1]=="8bit"){
echo imap_8bit($attach_content[1]);
}
if($attach_info[1]=="quoted-printable"){
echo stripslashes(quoted_printable_decode($attach_content[1]));
}
if(empty($attach_info[1])){
echo stripslashes($attach_content[1]);
}
}
Expected result:
----------------
binary source will be printed by php so could be downloaded by browser..
Actual result:
--------------
0 bytes
--
Edit bug report at http://bugs.php.net/?id=25355&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25355&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25355&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25355&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25355&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25355&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25355&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25355&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25355&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25355&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25355&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25355&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25355&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25355&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25355&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25355&r=gnused