[imp] Attachment size - works for 1M, not for 2M

Diego Rivera lrivera at racsa.co.cr
Thu Oct 2 12:54:53 PDT 2003


Here's something interesting:

I tried the following test page:

<-- BEGIN -->
<?php

// Change this to 1 or 0 to select 
// to manually read the file (1) or
// use the "batch" read function.
$use_fread = 0;

$file = "/var/cache/httpd/php/tmp/test.dat";

$contents = "";
$method = "";
$fsize = filesize($file);

if ($use_fread)
{
    $method = "fopen()/fread()/fclose()";
    $fd = fopen($file, 'rb');
    $contents = fread($fd, $fsize);
    fclose($fd);
} else {
    $method = "file_get_contents()";
    $fsize = filesize($file);
    $contents = file_get_contents($file);
}
$clength = strlen($contents);
unlink($file);

echo("<p>File used: $file</p>");
echo("<p>Method used: $method</p>");
echo("<p>File Size = $fsize</p>");
echo("<p>Contents read = $clength</p>");

?>
<-- END -->

The "test.dat" file was several sizes: 1M, 2M, 4M, 8M, 16M.  All the
tests worked correctly (with both 0 and non-0 values for $use_fread).

So now the question becomes: why on the same server (same virtual server
even - it's on the horde root directory!) does this work and horde's
version of this same code sequence (albeit wrapped in other stuff) NOT
work.

Specifically: what is Horde/IMP doing that could be causing PHP to break
so that this same instruction sequence works outside of Horde, but not
inside of it?

Of special interest is why if I remove the "unlink()" call in
"compose.php" (after reading the attachment) I keep getting "connection
broken" errors.

As I said earlier - I smell a PHP bug, but I can't quite place it and
may very well be mistaken.

Let's keep searching and see what we find...

Best

________________________________________________________________________
-- 
===========================================================
* Diego Rivera                                            *
*                                                         *
* "The Disease: Windows, the cure: Linux"                 *
*                                                         *
* E-mail: lrivera<AT>racsa<DOT>co<DOT>cr                  *
* Replace: <AT>='@', <DOT>='.'                            *
*                                                         *
* GPG: BE59 5469 C696 C80D FF5C  5926 0B36 F8FF DA98 62AD *
* GPG Public Key avaliable at: http://pgp.mit.edu         *
===========================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.horde.org/archives/imp/attachments/20031002/e1ab0077/attachment.bin


More information about the imp mailing list