Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Count error TagController.php in PHP 7.2

Status Resolved
Add-on / Version Bloqs 4.0.4
Severity
EE Version 4.3.2

David Clough

Jul 20, 2018

I’m getting an error line 267 in TagController.php

Relating to use of count on a non array/object

This is a PHP 7.2 related issue

If you modify the code
          $context->setTotalChildren(count($children));
          $context->setTotalSiblings(count($siblings));

to

          $children = is_array($children) ? count($children) : 0;
          $siblings = is_array($siblings) ? count($siblings) : 0;
          // Create some additional {blocks:X} variables
          $context->setTotalChildren($children);
          $context->setTotalSiblings($siblings);

This resolved the issue.

There are other instances of count which could potentially cause an error but I’ve not amended those.

#1

BoldMinded (Brian)

Thanks for reporting this. What is the actual error message you’re getting?

#2

David Clough

count(): Parameter must be an array or an object that implements Countable line 267 TagController.php

#3

BoldMinded (Brian)

Comment has been marked private.

#4

David Clough

That’s working for me, thanks

#5

BoldMinded (Brian)

Excellent. It’ll be included in the next release. Thanks for testing!

Login to reply