On PHP 7.2, Easy Breadcrumb will trigger a warning if the breadcrumb is empty:

Warning: count(): Parameter must be an array or an object that implements Countable in template_preprocess_easy_breadcrumb()(line 158 of [...]/easy_breadcrumb.module).

This is because PHP 7.2 gives a warning when attempting to count non-countable objects:
http://php.net/manual/en/migration72.incompatible.php#migration72.incomp...

Reproduction steps:

  1. Install Drupal 7.x and Easy Breadcrumb 7.x-2.x on PHP 7.2
  2. Make sure the Easy Breadcrumb block is enabled
  3. In the settings for Easy Breadcrumb, uncheck/disable "FIRST BREADCRUMB" and "FINAL BREADCRUMB"
  4. Visit the home page or a direct child of the home page to receive the warning

Comments

.tom created an issue. See original summary.

tatarbj’s picture

Assigned: .tom » tatarbj
Status: Active » Needs work

Thanks @.tom,
let me get back to you with a patch to resolve it!
Bests,
Balazs.

.tom’s picture

@tatarbj

I already wrote a patch, I was just getting the naming right. Please check!

Cheers!

.tom’s picture

Status: Needs work » Needs review
tatarbj’s picture

That's exactly what I'm thinking about - should we check the availability there (isset() seems a better approach) or initialize it before the foreach().
Could you just confirm the isset() also resolves the warning on your end (having issues with setting up php7.2 at the moment).

tatarbj’s picture

Just in case, I've queued both of the patches for PHP 7.2 & MySQL 5.5 to see the tests.

.tom’s picture

Yes, isset() works fine for me. I originally wrote isset(), but thought that is_array() might be (marginally) better since isset() still leaves room for non-countable values. But I don't know if this could ever actually occur.

  • tatarbj committed 3fc3104 on 7.x-2.x
    Issue #3043400 by .tom, tatarbj: Empty breadcrumb warning: count()
    
tatarbj’s picture

Status: Needs review » Fixed

Thanks @.tom,
it's committed and will be in the new release when other issues are done too.
Bests,
Balazs

tatarbj’s picture

Status: Fixed » Closed (fixed)