I'm getting this in my logs, I believe since upgrading to PHP 7.2

Warning: count(): Parameter must be an array or an object that implements Countable in popup_element() (line 242 of /my-site/sites/all/modules/popup/includes/popup.api.inc).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jaydee1818 created an issue. See original summary.

jigish.addweb’s picture

Status: Active » Needs review
FileSize
1008 bytes

@jaydee1818, Count function getting $body variable null. It is the cause of the issue. I put condition if the variable is not null then only count the value.
Kindly review it.. I hope this patch helps you to resolve your issue

Thanks!..

Cybertrail’s picture

The patch fixed the error but there is still a notice about an undefined variable.
Notice: Undefined variable: popup_body in popup_element() (line 259 of /home/f9o3h7sufm61/public_html/sites/all/modules/popup/includes/popup.api.inc).

joelpittet’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
FileSize
521 bytes

This should fix #3's issue.

joelpittet’s picture

FileSize
503 bytes

Actually it doesn't but all that needs to change here is count() to strlen() and NULL is fine I checked.

php -r "strlen(trim(NULL));"

  • ilchovuchkov committed b93f931 on 7.x-1.x
    Issue #3021642 by joelpittet, jigish.addweb: Popup PHP 7.2 Warning -...
vuil’s picture

Status: Needs review » Fixed

The patch is committed. Thank you!

Status: Fixed » Closed (fixed)

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

vuil’s picture