3.9 and Spam Protection Plugin

Hello. I do know that this is a plugin made by somebody else, but this is a stopper for many people.

There is a fatal error with 3.9 and that plugin. And i can’t be without that plugin.

I would like to ask for possible assistance here. If so, i can post more details. It is something related to phpmailer.

Thank you

Please, share some error logs.

Before sending error log please try using this modified plugin.

Thanks but this is a very old version.

Sorry I only get this version from official repo. Guide me to the latest version.

The last posted on Osclass Market was 1.7.1 and from what i see we use 1.7.4

Try this one

Exactly same problems but NO Fatal debug error (for some reason). Only those two:

[13-Dec-2019 09:47:48 Europe/Madrid] PHP Warning: in_array() expects parameter 2 to be array, boolean given in /home/oc-content/plugins/spamprotection/classes/class.spamprotection.php on line 1712

[13-Dec-2019 09:48:21 Europe/Madrid] PHP Warning: Invalid argument supplied for foreach() in /home/oc-content/plugins/spamprotection/admin/tools.php on line 452

I was informed that there is a ui glitch where these fatal errors occurred. Please let me know how to reproduce these errors.

false alarm, same files

I don’t know when exactly those errors happen. They do happen in the admin dashboard.

It is easy to see what doesn’t work, just try to select the Tools (the wrench) at the right top of the plugin. Doesn’t do anything.

Same version 1.7.4 is working fine for me after modification. clicking on the wrench icon properly navigate to other settings.

I will try again, from scratch.

You are right, it works. Not sure what i did before. Maybe i mixed the downloads …

I will upload this version on a 3.8 production site and see how it goes. I will update.

In any case many thanks

Just showed in debug log

[13-Dec-2019 20:39:38 Europe/Madrid] PHP Warning: in_array() expects parameter 2 to be array, boolean given in /home/oc-content/plugins/spamprotection/classes/class.spamprotection.php on line 1712

These are warnings which will not hinder the functionality of this plugin. BTW these may not be related to osclass itself. Plugin is poorly written( or I would say with lack of care ) that’s why we can’t fix all of the plugin issues please contact the developer for that.
I have fixed the fatal error and it will work properly.

Sure, i understand. Still 1.7.4 works with 3.8 for 2 years now without those errors/warnings/notices.

As for the fatal fix, again thanks.

There can be hundreds of reasons for those warnings, php version change or settings changed. Previously many errors were silenced in osclass we have removed that behaviour from many places and will continue to do so.
This behaviour allowed crappy code to fail silently which is not a good thing and create hard to debug errors.
We have also upgraded many libraries in osclass which also throw new errors and exception if wrong arguments passed.
In last we have changed so many things in osclass core and it’s possible that those changes can break things and we are here to help in those cases.

But in this case that fatal error has nothing to do with osclass, the error was that “invalid email address passed” and when I checked plugin’s file I found an empty string ‘’ was passed as email address to phpMailer library and library rightly throwing the error. It should be checked in a plugin before passing it to phpMailer library. I added that check and fatal error got fixed.

Now it may seem that new osclass is making your installation unstable but in reality, it is uncovering the previously hidden issues.


1 Like

I have forked Spam protection plugin repository added above fixes with some other changes.

The github version has a fatal error:

[13-Dec-2019 14:55:30 America/Los_Angeles] PHP Parse error: syntax error, unexpected ‘require’ (T_REQUIRE) in /home/public_html/oc-content/plugins/spamprotection/index.php on line 1

and appears scrumbled. In the ftp view.
Very strange

(it seems the index.php root file is not closed properly)