Support » Plugin: Perfect WooCommerce Brands » PHP 7 warnings

  • Resolved pedrorafael



    there is a bug on the product page caused by php version 7, below:

    Warning: sizeof(): Parameter must be an array or an object that implements Countable in ............/wp-content/plugins/perfect-woocommerce-brands/classes/class-perfect-woocommerce-brands.php on line 484

    It looks like this has already been reported and this bug will be fixed in the next php updates.

    But I think you could fix this for plugin users by modifying line 484 of class-perfect-woocommerce-brands.php file.

    Provisional solution:
    – if( sizeof( $brands>0 ) ){
    + if (!is_array( $brands>0 ) || (is_array( $brands>0 ) && !sizeof( $brands>0 ))) {

    I hope I have helped, because this is a great plugin!

    Pedro Vasconcelos.

    • This topic was modified 1 year, 9 months ago by  pedrorafael.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author titodevera


    Hola Pedro.

    En primer lugar agradecerte el reporte.

    En estos momentos estoy trabajando en una actualización del plugin (que verá la luz en los próximos días), este problema será corregido en dicha actualización.

    El problema viene dado por una utilización incorrecta de sizeof().
    Lo correcto sería if( sizeof( $brands ) > 0 )

    Un saludo

    Hi @titodevera,

    thanks and congratulations for the plugin!

    Pedro Vasconcelos.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP 7 warnings’ is closed to new replies.