php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43670 imap_savebody writes invalid base64
Submitted: 2007-12-24 19:20 UTC Modified: 2008-01-28 23:59 UTC
From: xtof at xtof dot com Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 5.2.5 OS: CentOS 5
Private report: No CVE-ID: None
 [2007-12-24 19:20 UTC] xtof at xtof dot com
Description:
------------
imap_savebody does not work correctly (invalid base64 written).

- using imap 2007 c-client
- I've also found that using imap_fetchbody on the same message part before the save will fix this bug!

ex : 

$fp = fopen('tmp/test.fetched','w');
fwrite($fp,imap_fetchbody($mbox,$id,2);
fclose($fp);

imap_savebody($mbox,'tmp/test.saved',$id,2);

>
>-rw-r--r-- 1 iol iol   131714 Dec 24 20:07 test.fetched
>-rw-r--r-- 1 iol iol   131714 Dec 24 20:07 test.saved

but :

imap_savebody($mbox,'tmp/test.saved',$id,2); // alone

>
>-rw-r--r-- 1 iol iol   131650 Dec 24 20:10 test.saved

a diff will show differences :

[root@iol tmp]$ diff test.saved test.fetched
133c133
< nbgqw4qlxEEfSvKg2mezJXjY5uVTHIyN2qInNeonpc8iWjsJmkoICimI
---
> nbgqw4qle26yxEEfSvKg2mezJXjY5uVTHIyN2qInNeonpc8iWjsJmkoICimI
265c265
< AmikwQtJSG2FFCEgoobGQE0matoTClxU7CQEUlCKDNGaYXAUtKQ0FFIT
---
> AmikwQtJSG2FFCEgoobGFFJIQE0matoTClxU7CQEUlCKDNGaYXAUtKQ0FFIT
397c397
< k71kxj1OO1aGnxu/3Bms6rtBs68N8ZLenUio7Vgp5rOnK9PQ3qP97ct/
(... 20 other differences not shown)

Thanks anyway for this very important function as we cannot use imap_fetchbody because of memory limitations.

Hope this helps,

Christophe.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-28 23:59 UTC] tony2001@php.net
Please report IMAP c-client bugs to its developers.
Thank you.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Feb 09 06:05:49 2023 UTC