Support » Plugin: Equal Height Columns » PHP 7.2 & count()

  • cjhaas

    (@chrisvendiadvertisingcom)


    On line 248 of /admin/class-equal-height-columns-admin.php the code below will break under PHP 7.2 if the value passed to count isn’t countable.

    $field_count = count( $this->options[ $this->options_group_slug ] ) ? count( $this->options[ $this->options_group_slug ] ) : 1;

    It should instead also include a call to is_countable()

    $field_count = is_countable( $this->options[ $this->options_group_slug ] ) && count( $this->options[ $this->options_group_slug ] ) ? count( $this->options[ $this->options_group_slug ] ) : 1;

    Unfortunately is_countable() won’t be added until PHP 7.3 but there’s a really simple polyfill available:
    https://github.com/Ayesh/is_countable-polyfill/blob/master/src/is_countable.php

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.