From: eric dot maman at free dot fr
Operating system: Windows 2000
PHP version: 4.3.4
PHP Bug Type: *URL Functions
Bug description: The base64_encode() function returns an string that cannot decoded
by outlook
Description:
------------
I am using the base64_encode() function to send attachements by email.
When I receive the mail on Outlook, the attachement is visible but
corrupeted.
I have tested the whole process and my conclusion is that the
base64_encode() function does not work correctly.
I have made a workarround with an extrenal program that performs the
base64 encoding and it work correctly.
Reproduce code:
---------------
function EncodeString ($str, $encoding = "base64") {
$encoded = "";
switch(strtolower($encoding)) {
case "base64":
$encoded = chunk_split(base64_encode($str), 76, $this->LE);
break;
case "7bit":
case "8bit":
$encoded = $this->FixEOL($str);
if (substr($encoded, -(strlen($this->LE))) != $this->LE)
$encoded .= $this->LE;
break;
case "binary":
$encoded = $str;
break;
case "quoted-printable":
$encoded = $this->EncodeQP($str);
break;
default:
$this->SetError($this->Lang("encoding") . $encoding);
break;
}
return $encoded;
}
--
Edit bug report at http://bugs.php.net/?id=26742&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26742&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26742&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26742&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26742&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26742&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26742&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26742&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26742&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26742&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26742&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26742&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26742&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26742&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26742&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26742&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26742&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26742&r=float