• 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)
  • I just upgraded multiple WP sites from PHP 7.0 and 7.1 to 7.2 and my server logs are now filling up with this issue too from the sites using this plugin

    PHP Warning: count(): Parameter must be an array or an object that implements Countable in /wp-content/plugins/equal-height-columns/admin/class-equal-height-columns-admin.php on line 248

    @chrisvendiadvertisingcom

    Thank you for the fix, I just updated to PHP 7.3.

    I guess the plugin is abandoned 🙁

    Not sure if there’s an alternative?
    Maybe someone is interested to take over this one.

    FortMaxWave

    (@knightwave)

    Same problem here with PHP 7.2 🙁

    FortMaxWave

    (@knightwave)

    @chrisvendiadvertisingcom

    Can you tell me how to use the polyfill?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP 7.2 & count()’ is closed to new replies.