Fatal error: Cannot use string offset as an array in /usr/home/www/sites/all/modules/antispam/antispam.module on line 1013

I get this error when I try to post a comment to a node.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Everett Zufelt’s picture

Status: Active » Postponed (maintainer needs more info)

I cannot reproduce this, can you please provide steps to reproduce?

joey1911’s picture

I just enabled the Module, went to a node and tried to post a comment.

It's using TypePad as the antispam module if that helps.

intropedro’s picture

In my drupal the line where the error is:

1011  if ($antispambot_rules['body'] && !empty($comment->comment_body)) { 
1012    $query->condition('c.comment', render($comment->comment_body[$comment->language][0]['value'])); 
1013    $debug_info['Content'] = $comment->mail[$comment->language][0]['value']; 
1014    $num_condition++; 
1015  } 

I have read in this web http://informationideas.com/news/2006/06/14/fatal-error-cannot-use-strin... that the error is produced by try use a vector when it is not a vector.

I do not know if this will help someone to solve the problem

Dmitriy.trt’s picture

FileSize
2.27 KB

Steps to reproduce:

  • Enable option "Identify spambots by -> Content that has already been identified as spam."
  • Try to post any comment
  • You get fatal error mentioned above

Causes:

  • Trying to get comment body from wrong property (mail)
  • Wrong table to select comment body from

Patch for the latest code from git is attached. It also resolves problem that conditions are joined using AND operator, while description on the settings form says "If a request to send content matches any of these rules, the actions defined below will be triggered". Also, when "body" rule is enabled together with other rules the query should use LEFT JOIN, e.g. to check email in nodes detected as spam too.

Dmitriy.trt’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Postponed (maintainer needs more info) » Needs review
intropedro’s picture

I have apply the patch and it has solved the error:

>> cd sites/all/modules/antispam
>> wget https://drupal.org/files/antispam-1483796-4.patch
>> patch -p1 < antispam-1483796-4.patch
patching file antispam.module
spolaorso’s picture

Thanks a lot! The patch solve the error!

maestrojed’s picture

This seems to be a duplicate of http://drupal.org/user/328606

Two different solutions. The solution here is nice because its an actual patch. It would be great to get a little review so we know which solution to use.

alexpsfti’s picture

Thanks it fixed my issue as well.

daryand’s picture

this patch fixed my error and problem as well.

thanks,
d

jemond’s picture

Status: Needs review » Reviewed & tested by the community

Patch fixes the issue which I could reproduce. It's running in production. This is ready to go.

tim.plunkett’s picture

Priority: Critical » Major
FileSize
2.82 KB
994 bytes

I've written an automated test for this.

tim.plunkett’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Routh’s picture

Version: 7.x-1.x-dev » 7.x-1.5

I am getting this with Version 7.x-1.5

Since I assume this patch was included with the 1.5 release, it seems that the issue was not resolved.

tim.plunkett’s picture

Version: 7.x-1.5 » 7.x-1.x-dev

I don't know why you would assume that, as it shows on the project page, 7.x-1.5 was released in July and this was fixed in November. You can use the dev version until 7.x-1.6 is released.

Routh’s picture

Whoops, missed that. I saw that the error was originally posted with 1.4, and assumed the fix had been patched in with 1.5 - On dev now and working. Sorry.

maxrossello’s picture

Please publish a new official version ASAP as the plugin is unusable and I do not want to link my production site to dev version.
Thanks!

Anonymous’s picture

Version: 7.x-1.x-dev » 7.x-1.5
Priority: Major » Critical
Issue summary: View changes
Status: Closed (fixed) » Active

I also am using 7.x-1.5 and get this exact error in exactly the same use case as originally documented (several years ago).

It is disturbing that a new "recommended release" addressing this and other reported critical/major bugs has not been released.

7.x-1.5 is almost 2 years old, and I also do not want to employ a dev release on my production site.

Pretty please...

DamienMcKenna’s picture

Status: Active » Closed (fixed)

Please do not reopen issues for bugs that have fixes already sitting in the dev release. Due to priorities in our lives we (the module's maintainers) just haven't gotten to do a new release that includes this fix. Until we do, it is recommended to try out the dev release, it should work.

Anonymous’s picture

IMHO, the module in question loses its integrity when critical known problems in the official release exist and are at least not pointed out on the module's main Drupal page. I also have a very busy life, and wasted a large amount of time due to this and my other reported error.

If the module's maintainers truly want people to use the dev release as if it was the official release, the module's Drupal page should state as much, in a manner that is highlighted.

DamienMcKenna’s picture

I've updated the project page to suggest using the dev release, thanks for the suggestion.

mssqldestination’s picture

Hi,

I am facing same problem on my Site http://www.mssqldestination.com

I have hosted it on Cpanel.

Can someone tell me which is the latest patch to apply and how can I apply it.

Many thanks in advance

DamienMcKenna’s picture

@mssqldestination: i suggest just using the -dev version.

Anonymous’s picture

@mssqldestination

IMHO, you will be wasting your time with the -dev version.

I switched to Mollom and have not looked back.