Check if block.module is enabled before calling block_load.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shadcn’s picture

Status: Active » Needs review
FileSize
2.79 KB
DanChadwick’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

Good catch.

Probably function_exists('block_load') would be faster and just as clear. Also there is no reason not to include this in the existing if, rather than creating a nested if block. The && operator is guaranteed to be short-circuit in PHP.

Marking as Normal because this affects only a small portion of sites, and they can temporarily enable block as a work-around. If you tweak up the patch, I'll get it committed a little sooner.

shadcn’s picture

Status: Needs work » Needs review
FileSize
1013 bytes

Updated.

DanChadwick’s picture

Status: Needs review » Reviewed & tested by the community

I will flip the order of execution to but the cheap, most likely negative on first. Thx for your work on this.

DanChadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Status: Reviewed & tested by the community » Fixed
FileSize
1012 bytes

I re-ordered for efficiency:

  if (!$node->webform['block'] && function_exists('block_load') && 
...

Committed to 7.x-4.x and 8.x. Thanks!

  • DanChadwick committed 3dec3a2 on 7.x-4.x
    Issue #2386979 by arshadcn: Fixed Fatal error: Call to undefined...
  • DanChadwick committed 732d21e on 8.x-4.x
    Issue #2386979 by arshadcn: Fixed Fatal error: Call to undefined...

Status: Fixed » Closed (fixed)

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

DanChadwick’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev