Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: aegersz on October 07, 2017, 12:32:10 PM

Title: report email to a selected/all administrator(s) fails
Post by: aegersz on October 07, 2017, 12:32:10 PM
report email to a selected/all administrator(s) fails

error:
Wrong value type sent to the database. Array of integers expected. (attach_ids)

log:
https://mysite/index.php?action=pm;sa=report;l=-1
Wrong value type sent to the database. Array of integers expected. (attach_ids)
Function: sendpm
File: /var/www/html/Sources/Subs-Post.php
Line: 961

if (count($attachments) >= 1)
948: {
949: $parent_attachments = array();
950:
951: $request = $smcFunc['db_query']('', '
952: SELECT
953: id_attach
954: FROM {db_prefix}pm_attachments
955: WHERE id_attach IN ({array_int:attach_ids})
956: AND attachment_type = {int:not_thumb}',
957: array(
958: 'attach_ids' => $attachments,
959: 'not_thumb' => 0,
960: )
==>961: );


sorry, this is not an SMF problem as it works in vanilla. I will try to figure out which mod is causing this.

Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on October 07, 2017, 01:55:32 PM
it was the Enhanced PM System mod (dougiefresh) that caused this but the mod is now gone so i'm not sure where you can move this post to (?)

I will PM dougiefresh and ask him what i should do.

Maybe you can move this to the Mods board ...



Title: Re: report email to a selected/all administrator(s) fails
Post by: Steve on October 07, 2017, 02:40:16 PM
Since the mod board is for specific mod support threads I'm inclined to just leave it here. More experienced team members may have a better idea.
Title: Re: report email to a selected/all administrator(s) fails
Post by: Sir Osis of Liver on October 07, 2017, 04:10:44 PM
That's not core code, it's from a mod.  Enhanced PM System was pulled by dougie, it's no longer on mod site.  Where did you get it?
Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on October 07, 2017, 05:58:58 PM
I got it ages when it was made available and I think I am on the last release.

my system is too complex to undo it so I will live with this bug unless dougie can help.
Title: Re: report email to a selected/all administrator(s) fails
Post by: Sir Osis of Liver on October 07, 2017, 06:17:38 PM
If you can identify the code in Subs-Post.php as being from that mod, you can try deleting it.  Can't parse the mod, it's not on mod site, but if you have the patience you can unzip the package and see if you can determine which code was left behind when it uninstalled.
Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on October 07, 2017, 07:02:36 PM
the mod is still installed and maybe I can try to fix it but it would take a lot of time to figure out what's going on.

I have PMed dougie asking for his advice, I'm hoping he can help me to make the appropriate changes even though the mod is unsupported.

the "Message" function has been modified to allow attachments.

I am quite happy with the EMS but it just has this bug which bothers me.

the function works ONLY in the test  system (weird?) if you add an attachment to the PM that you want to report to Admin
Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on October 07, 2017, 08:10:13 PM
silly me, i had removed EMS in testing, that's why it works.
Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on October 07, 2017, 10:49:29 PM
the code that is reported in error was created by the "PM Attachments" mod.
Title: Re: report email to a selected/all administrator(s) fails
Post by: dougiefresh on October 10, 2017, 11:22:13 AM
Can you attach your Sources/Subs-Post.php file so that I can see what is going on there?
Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on October 14, 2017, 06:51:31 AM
Thanks dougie but don't waste too much time on it, just if you can see anything obvious ... sorry about the delay.
Title: Re: report email to a selected/all administrator(s) fails
Post by: dougiefresh on October 14, 2017, 11:14:19 AM
The code in question comes from the PM attachments mod.  Considering it works without the EPM mod, it is unlikely that the code itself is wrong.  It's more probable that another function is calling the sendpm function with wrong arguments, which (unfortunately) is possible since the code makes alterations to the function declaration....  Without knowing what function is calling the sendpm function incorrectly, I can't even guess at which file to look at next....
Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on October 14, 2017, 01:09:24 PM
no problem.

thanks for looking into it ... i have never had to use it and nobody has mentioned it to me so i can live quite happily without this function, anyway.
Title: Re: report email to a selected/all administrator(s) fails
Post by: Geor'G on January 17, 2018, 03:24:03 PM
Quick fix.
In the file Subs-Post.php, find:
$str_attachments = '';

if (count($attachments) >= 1)


Replace:

$str_attachments = '';

if(!is_array($attachments))
$attachments = array();

if (count($attachments) >= 1)
Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on January 17, 2018, 05:04:01 PM
yeah ? i will give it a try ... thanks mate !
Title: Re: report email to a selected/all administrator(s) fails
Post by: aegersz on January 19, 2018, 06:42:45 AM
works well ! thanks again,