Recent Topics

[4.0.2-beta] PHP error in _basic_antispam.plugin.php (fixed)

Started by on Dec 12, 2010 – Contents updated: Dec 12, 2010

1 Dec 12, 2010 01:09    

My b2evolution Version: 4.0.2-beta

I installed 4.0.2-beta as an upgrade to 3.3.3 on my test system. With PHP error message reporting setting "display_errors = on" (for debugging another project) I get the following error as part of each entry on the "Comment awaiting moderation" screen:

Notice: Undefined index: makelink in C:\<path-to-server>\b2evolution\blogs\plugins\basic_antispam_plugin\_basic_antispam.plugin.php on line 214

I verified the the version of this file in use on my test server is the one that came wit the 4.0.2-beta package.

I modified line 214 from

if( ! $params['makelink'] )

to
if(! isset($params['makelink']) or ! $params['makelink'] )

and the error message went away.

I'm running PHP 5.3.1 as part of an XAMPP package.

2 Dec 12, 2010 18:14

Similar thing with me on the makelink error:

Notice: Undefined index: makelink in /var/www/html/wtnh.tv/blogs/plugins/basic_antispam_plugin/_basic_antispam.plugin.php on line 214

3 Dec 12, 2010 18:31

Note the "beta" in the version number ;)

Moving this to bugs forum

¥

5 Dec 27, 2010 00:40

sam2kb wrote:

Fixed in CVS

http://evocms.cvs.sourceforge.net/viewvc/evocms/b2evolution/blogs/plugins/basic_antispam_plugin/_basic_antispam.plugin.php?revision=1.39&content-type=text%2Fplain

Reload plugins after you edit the file /plugins/basic_antispam_plugin/_basic_antispam.plugin.php

It appears your modifications did not make it to b2evolution 4.0.3 stable. I had to download your reference file and replace the one bundled with b2evo 4.0.3 -which apparently is version 1.37 whereas yours is version 1.39

< * @version $Id: _basic_antispam.plugin.php,v 1.37 2010/02/08 17:56:01 efy-yury Exp $
---
> * @version $Id: _basic_antispam.plugin.php,v 1.39 2010/12/10 21:03:29 sam2kb Exp $

I was noticing in my Apache error log file multiple entries similar to what follows:

[client abc.def.ghi.jkl] PHP Notice: Undefined index: makelink in /my/path-to-my/blog/plugins/basic_antispam_plugin/_basic_antispam.plugin.php on line 214

Cheers!

6 Dec 27, 2010 01:18

Yeah, I noticed that too. I already sent a message to FG, hopefully he'll update the download.

7 Jan 16, 2011 22:59

Well, I do not know how it got fixed in CVS or the new version, but it's likely to be wrong - if not the hook invocation got fixed.

See this fix here: https://github.com/whissip/whissip/commit/4607124277c8c49b39da8ebbf153643a30d101f4

The problem is that "makelink" does not get passed from the plugin hook anymore, and every plugin making use of it would have to get "fixed" - it is no fix however, if you check if an accepted param exists.

In this case the notice alerts you that something is wrong, and it's the hook in this case.

8 Jan 17, 2011 03:16

Cool, added your fix to CVS

11 Jan 19, 2011 12:22

blueyed wrote:

Thanks.
Then please revert the wrong fix, too.

Should be something like this:
https://github.com/whissip/whissip/commit/28a87487a2f84b11e7ec88c42487125ea7807b69

btw: this change is wrong because of two things:
1. "makelink" is always expected (and should throw a notice)
2. you should have used "empty", not isset - if "makelink" is provided as "true", it would return here, too.

Got raw file from your site:

wget --no-check-certificate https://github.com/whissip/whissip/raw/master/blogs/plugins/basic_antispam_plugin/_basic_antispam.plugin.php

A quick diff between sam2kb/basic_antispam_plugin & blueyed/basic_antispam_plugin shows:

30c30
< * @version $Id: _basic_antispam.plugin.php,v 1.39 2010/12/10 21:03:29 sam2kb Exp $
---
> * @version $Id$
251c251
< if( ! isset($params['makelink']) )
---
> if( ! $params['makelink'] )
663c663
< * $Log: _basic_antispam.plugin.php,v $
---
> * $Log$

Now I replace my current blog sam2kb/basic_antispam_plugin file with blueyed/basic_antispam_plugin and this is what my Apache error.log file shows:

[Wed Jan 19 02:53:43 2011] [error] [client xy.abc.def.ghi] PHP Notice: Undefined index: makelink in /myBlog/directoryPath/blog/plugins/basic_antispam_plugin/_basic_antispam.plugin.php on line 251
[...48 more lines snipped...]
[Wed Jan 19 02:57:14 2011] [error] [client tu.hij.kl.mno] PHP Notice: Undefined index: makelink in /myBlog/directoryPath/blog/plugins/basic_antispam_plugin/_basic_antispam.plugin.php on line 251
[Wed Jan 19 02:57:14 2011] [error] [client tu.hij.kl.mno] PHP Notice: Undefined index: makelink in /myBlog/directoryPath/blog/plugins/basic_antispam_plugin/_basic_antispam.plugin.php on line 251
[Wed Jan 19 02:57:14 2011] [error] [client tu.hij.kl.mno] PHP Notice: Undefined index: makelink in /myBlog/directoryPath/blog/plugins/basic_antispam_plugin/_basic_antispam.plugin.php on line 251
[Wed Jan 19 02:57:14 2011] [error] [client tu.hij.kl.mno] PHP Notice: Undefined index: makelink in /myBlog/directoryPath/blog/plugins/basic_antispam_plugin/_basic_antispam.plugin.php on line 251

Hence, I returned sam2kb/basic_antispam_plugin to my blog and errors are gone once again.

Cheers.

13 Jan 19, 2011 13:42

I added the second fix to cvs too. Just get the latest revision.

14 Jan 19, 2011 14:17

blueyed wrote:

nanahuatl, you need the other/correct fix, too - see my message above (http://forums.b2evolution.net//viewtopic.php?p=106947&sid=699bbcbaa1a1866d290eeea058a7ec01#106947).

Ok, I got your other fix (prior to noticing sam2kb reply):

wget --no-check-certificate https://github.com/whissip/whissip/raw/4607124277c8c49b39da8ebbf153643a30d101f4/blogs/inc/comments/model/_comment.class.php

After backing up the original, I overwrote the relevant file with the _comment.class.php downloaded previously as above. There are no more errors produced in Apache error.log :D

Thanks to you and sam2kb for the replies.

Best Professional Regards.

15 Jan 19, 2011 15:57

Good it works now.
However, you rather not want to replace the whole file - it is a fork/different branch after all.

In case it works out, fine, but just wanted to notice you about this.
You should have patched/manually edit your file instead.

16 Jan 19, 2011 17:04

blueyed wrote:

Good it works now.
[...]
In case it works out, fine, but just wanted to notice you about this.
You should have patched/manually edit your file instead.

Thanks for the warning. I only replaced the relevant lines as per your indications. I do not want security issues due to possible extraneous undefined variables.

http://www.metztli-it.com/readOnlyEphemeral/_comment_class_php.png

Cheers!

17 Feb 01, 2011 15:21

Sorry if this question is a little dense, but is the fixed plug-in available for download, or do I have to modify ver 1.37 myself?

If it's available for download, could someone please provide the link?

Thanks!
Ross

18 Feb 01, 2011 15:45

Seems like the antispam plugin piece is already OK. I used Blueyed's fix for _comment.class and the problem is fixed. Thanks!


Form is loading...

Build your own website! – This forum is powered by b2evolution CMS, a complete engine for your website.