I'm getting the following error intermittently showing up in my logs. I think this module might be doing some operations before includes/unicode.inc is loaded, (for example, in hook_init() or hook_boot()) and not properly checking for the availability of core functions.

Call to undefined function drupal_strtolower() in drupal/sites/all/modules/contrib/acquia_purge/acquia_purge.module on line 794

Note: I was also seeing a lot of PHP errors about calls to drupal_get_path_alias() from url(), but I have applied this patch to mitigate those issues and I am not sure they are caused by this module, but I suspect they may be related.

I'm filing this issue as major as these PHP fatals are causing site downtime. I haven't found a solution yet but will continue to work on it. Posting here in case anyone else is having the same problem and/or working on a fix!

Comments

jenlampton created an issue. See original summary.

jenlampton’s picture

Issue summary: View changes
jenlampton’s picture

Version: 7.x-1.x-dev » 7.x-1.3
Status: Active » Needs review
StatusFileSize
new639 bytes

I'm attaching a patch here for the 7.x-1.3 version of the module. The patch did not apply cleanly to the 1.x-dev branch so it will likely need some reworking to fix the problem there, should it still exist.

I'm not sure what benefit using drupal_strtolower() provided in this instance, but I've switched it out with PHP's strtolower() in the instances when Drupal isn't fully bootstrapped (or includes/unicode.inc isn't properly loaded.)

I've done some more investigating and it looks like the PHP fatal on purging only happens when $conf['acquia_purge_lateruntime'] = TRUE; is set in settings.php, and even then, only some of the time. (so I'm downgrading this from Critical to Major). I have several sites running acquia_purge without that setting, and those have never had any problems using drupal core functions while purging.

Registering a _drupal_shutdown_function to do the purge is probably not a wise choice here. Drupal is not (always) fully bootstrapped at this runtime phase, so you need to be sure not to call any core functions without explicitly requiring the files they're defined in.

jenlampton’s picture

Issue summary: View changes

Status: Needs review » Needs work

  • japerry committed 4e769014 on 7.x-1.x authored by jenlampton
    Issue #2966566 by jenlampton, japerry: Call to undefined function...
japerry’s picture

Status: Needs work » Fixed

It looks like some other functions within common.inc load unicode.inc if it hasn't loaded yet. Because drupal_strtolower doesn't reference any other functions/methods other than php, this looks safe to do. Pushed to head, so you'll need to upgrade to 7.x-1.4 when its out.

Status: Fixed » Closed (fixed)

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