Opened 4 years ago

Closed 4 years ago

#1486284 closed Bugs (fixed)

PHP 5.3 warning in rcube_imap.php

Reported by: iezzip Owned by:
Priority: 5 Milestone: 0.4-beta
Component: IMAP connection Version: 0.3.1
Severity: normal Keywords:
Cc:

Description

Under very rare circumstances I am experiencing the following:

PHP Warning:  strtolower() expects parameter 1 to be string, array given in /.../roundcube/program/include/rcube_imap.php on line 1285

This only happens under PHP 5.3.0, AFAIK not in 5.2.11
The relevant line in program/include/rcube_imap.php:

          // fetch message headers if message/rfc822 or named part (could contain Content-Location header)
          if (strtolower($part[$i][0]) == 'message' ||

I was able to reproduce it on an HTML-email of a customer. Here's the offending var_export($part[$i][0]):

array (
  0 => 'TEXT',
  1 => 'PLAIN',
  2 => 
  array (
    0 => 'CHARSET',
    1 => 'iso-8859-1',
  ),
  3 => 'NIL',
  4 => 'NIL',
  5 => '7BIT',
  6 => '4055',
  7 => '82',
  8 => 'NIL',
  9 => 'NIL',
  10 => 'NIL',
)

Usually, $part[$i][0] should just contain 'TEXT'.
Hope you find a solution for that. I cannot offer a patch as I don't really understand that part of code.

Change History (3)

comment:1 Changed 4 years ago by iezzip

the offending email that produced this warning contained the following parts:

MIME-Version: 1.0
X-Mailer: Html Mime Mail Class
Content-Type: multipart/mixed;
        boundary="=_027926ba082b88fb65c219d838ede7e7"

This is a MIME encoded message.

--=_027926ba082b88fb65c219d838ede7e7
Content-Type: multipart/alternative;
        boundary="=_6ccd0df0960699b970e413f219bd4161"

--=_6ccd0df0960699b970e413f219bd4161
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Message content...

--=_6ccd0df0960699b970e413f219bd4161
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: base64

base64 encoded HTML-content...

--=_6ccd0df0960699b970e413f219bd4161--

--=_027926ba082b88fb65c219d838ede7e7--

(sorry, I'm not able to print the whole email headers/content as this is a customer's private email)

Looks like there is some base64 encoded MIME content inside another's (non-standard??)

comment:2 Changed 4 years ago by iezzip

here are the GET requests where this warning occurs (preview pane):

GET /?_task=mail&_action=preview&_uid=26610&_mbox=INBOX&_framed=1
GET /?_task=mail&_action=get&_uid=26610&_mbox=INBOX&_part=2.2

This always happens in message bodies that contain both a text/plain version followed by a text/html version.
In other emails (preview pane) the same warning also occurs on line 1305, program/include/rcube_imap.php, further down:

    // regular part
    $struct->ctype_primary = strtolower($part[0]);
>    $struct->ctype_secondary = strtolower($part[1]);
    $struct->mimetype = $struct->ctype_primary.'/'.$struct->ctype_secondary;

again, this happens in a multi-part message in MIME format.

comment:3 Changed 4 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [7a05909d].

Note: See TracTickets for help on using tickets.