wp-keitai-mail and PHP5

Last month I finally got around to updating to PHP5 which had the unfortunate side effect of breaking Dr. Dave’s excellent wp-keitai-mail script. After upgrading it would throw the following error:

PHP Fatal error: Using $this when not in object context in /var/www/moblog/joncellini.com/mimedecode.php on line 168

Fortunately with a bit of googling I was able to come up with an easy fix. Altering the syntax on line 156 of wp-keitaimail.php does the trick.

Before:

$structure = Mail_mimeDecode::decode($mime_params);

After:

// hack to fix PHP5 error
// $structure = Mail_mimeDecode::decode($mime_params);
$mail_mimedecode=new Mail_mimeDecode($input);
$structure = $mail_mimedecode->decode($mime_params);

This fix got version 1.6b of the script working again :)

Leave a comment