Thomas Bruederli wrote:
According to the PHP manual, substr() should always return a string.
However, I changed the code and added a casting for the return value of
$this->decode_header(). This should now fix this problem.

Hi, apologies for my first post to this list being a correction but that
is not quite right (and further apologies to Thomas who got this as a personal reply before I realised I was using a new mail client and hadn't replied to list).

If the string is empty then substr() will always return FALSE, may I
suggest the following as a nicer option?

$foo = empty($headers->cc) ? "" :
substr($this->decode_header((string)$headers->cc, TRUE), 0, 128);

It eliminates the relatively expensive substr() when there is no CC
header (the majority of email (well mine at least)) at the expense of a
cheap empty() call for every message.  As I don't have the CVS version
installed yet I can't test it nor do I know where this fits in your code
so apologies if I turn out to be talking utter crap.

Congratulations on an excellent project, I know nothing about Javascript
so am sat in awe of the beautiful interface.

Regards,

Gareth Davies



Reply via email to