Module

Developer
Supported

Messaging

ExpressionEngine 2, ExpressionEngine 3

Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy

     

You must be logged in to post.

Undefined variable: mimes

Support Request

tansel
tansel

Hi Yuri,

I need to enable the pm attachments. When sending, attaching files work fine.

However, when when viewing a pm, when clicked on the message attachments {download_url} link, I am receiving the following error:

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: mimes
Filename: messaging/mod.messaging.php
Line number: 3371
(this could be slightly different as I added some custom lines but not related to this section)

Line 3371 in my mod.messaging.php

$mime = (is_array($mimes[$extension])) ? $mimes[$extension][0] $mimes[$extension]

Could it be related to config.php file of EE 2.10.1

Yuri Salimovskiy
# 1
Developer
Yuri Salimovskiy

Do you have mimes.php in your EE config folder?

tansel
# 2
tansel

Yes I do.

$whitelist = array(
 
'application/csv'// .csv
 
'application/epub+zip'// .epub
 
'application/excel'// .csv, .xl, .xls
 
'application/mac-binhex40'// .hqx
 
'application/mac-compactpro'// .cpt
 
'application/msword'// .doc, .word
 
...
 ... 
Yuri Salimovskiy
# 3
Developer
Yuri Salimovskiy

I don’t have copy of EE 2.10.1 right at the hand, but in EE 2.9.2 the array is named $mimes, not $whitelist
And it’s $whitelist in EE 3
So I guess I’ll need to support both variables names in the module.
For now, just replace all instances of $mimes in mod.messaging.php with $whitelist

tansel
# 4
tansel

I made the change.

The error message turned to

Message: Undefined index: png (changes depending on the file type of the attachment)

at the same 3371 line of mod.messaging.php which looks like:

3369 else
3370 {
3371  $mime 
= (is_array($whitelist[$extension])) ? $whitelist[$extension][0] $whitelist[$extension];
3372 } 
Yuri Salimovskiy
# 5
Developer
Yuri Salimovskiy

ah, they also change the structure of the array!

wait for the fix then - or if you need it urgently, remove all mime-related code, it should work even without it

tansel
# 6
tansel

I will wait for the fix.