message
Warning: count(): Parameter must be an array or an object that implements Countable in adaptivetheme_links() (line 392 of sites/all/themes/adaptivetheme/at_core/inc/theme.inc).

The warning is about $links. The assumption is that $links is an array, but it can be NULL, so replacing count() with !empty() should work, I think.

CommentFileSizeAuthor
adaptivetheme-countable.patch350 bytesjacob.embree

Comments

jacob.embree created an issue. See original summary.

jacob.embree’s picture

Issue summary: View changes
lamp5’s picture

I can confirm that this patch fixes warnings. It should be committed to dev branch.

jacob.embree’s picture

Status: Needs review » Reviewed & tested by the community
andileco’s picture

+1 for the patch

alysaselby’s picture

Worked for php 7.2.16
Core 7.65
Adaptive Theme 7.x-3.4

aohrvetpv’s picture

The API documentation for theme_links() doesn't say that it can be NULL:
https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_li...

Under what circumstances is $vars['links'] NULL? (How can this be reproduced?)

jacob.embree’s picture

Good question. Now that https://git.drupalcode.org/project/drupal/commit/083a4ec is in it may not happen anymore, but I'll try without the patch for a while and see if it comes up anymore.
Either way, !empty() makes more sense and will match core (https://www.drupal.org/node/2988184),

arx-e’s picture

I have been seeing the same error with php 7.3 even with the latest drupal 7.68.
Patch fixed it.

danchadwick’s picture

I'm seeing this with PHP 7.4 and Drupal 7.73. Applied patch and PHP warning is gone.

+1 RTBC

And a tagged release would be great for those of us using PHP 7.

  • mattbloomfield committed 5de3114 on 7.x-3.x
    Issue #2968651 by jacob.embree, DanChadwick: Fix call to count() on non-...
mattbloomfield’s picture

Status: Reviewed & tested by the community » Fixed

This has been committed to the dev branch and will get a release very soon.

Status: Fixed » Closed (fixed)

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