This doesn't seem to effect the way the module works, but it is just a bit annoying to see the error in the recent log messages. It looks like when visitors are going to my site they are generating an php error:

Error: Call to undefined function drupal_strtolower() in abuseipdb_exit() (line 18 of home/sites/all/modules/abuseipdb/abuseipdb.module).

I noticed that this only happens on the initial attempt to reach the site, but not if they are visiting different pages. At the moment, unless I am testing, my site is running in maintenance mode while I build the site, and my site also is set for the base url to go to https without the www. I mention this because I had other errors that were popping up with this right after I set the site to https and no www, and they were fixed by making adjustments and corrections. This is the last error that pops up now, but it doesn't interfere with anything that I can see so far.

The module seems to work fine and is reporting and blocking as it should, I am just seeing these errors with every visitor and this site isn't even fully functional yet. The only visitors I get right now are spammers and search engines at the moment, but when this site goes live, this is going to clog my log with the same error.

I just feel like I am missing something really obvious here and can't see it, any help would be appreciated. thanks

If it helps I am running PHP 7.1.15

Comments

whncs created an issue. See original summary.

mieg’s picture

I also had a lot of these errors in log files. This happens if full page caching is turned on, because in that case hook_exit doesn't have the full drupal stack loaded. For now the solution is to turn page caching off, but it would be nicer if we could get the module working for sites with caching turned on.

tolstoydotcom’s picture

Here's a patch (against dev) that seems to fix that issue and a few others.

tolstoydotcom’s picture

StatusFileSize
new1.82 KB
intrafusion’s picture

Status: Active » Needs review

This appears to work great, changed to status to trigger testbot

ikphilip’s picture

Status: Needs review » Needs work

So I've applied this patch but I've come across another similar error message. PHP 7.2.x.

Error: Call to undefined function drupal_get_path_alias() in abuseipdb_exit() (line 24 of ./abuseipdb/abuseipdb.module).

Here's some helpful information from API Docs: https://api.drupal.org/api/drupal/modules!system!system.api.php/function...

If you implement this hook and see an error like 'Call to undefined function', it is likely that you are depending on the presence of a module which has not been loaded yet. It is not loaded because Drupal is still in bootstrap mode.

mieg’s picture

This can be solved in a similar fashion, add these lines before line 24:

if (!function_exists('drupal_get_path_alias')) {
require_once DRUPAL_ROOT . '/includes/path.inc';
}

ikphilip’s picture

StatusFileSize
new2.05 KB

OK, well I've created the new patch. I'm going to commit this to 7.x-1.x branch.

  • ikphilip committed c8d023f on 7.x-1.x
    Issue #2952243 by TolstoyDotCom, ikphilip, mieg: php error when visitors...
ikphilip’s picture

Status: Needs work » Fixed
ikphilip’s picture

Status: Fixed » Closed (fixed)