• Latest version is not compatible with PHP 8.x because “Unparenthesized a ? b : c ? d : e is not supported”.

    This can be solved easily replacing code from lines 330 to 344 on file class_popularity-posts-widget.php:

                $shortcode_ops = array(
                    'header' => strip_tags($header),
                    'range' => (in_array($range, $range_values)) ? $range : 'all',
                    'number' => empty($limit) ? 5 : ((is_numeric($limit)) ? (($limit > 0) ? $limit : 5) : 5),
                    'posts_title_length' => empty($title_length) ? 60 : ((is_numeric($title_length)) ? (($title_length > 0) ? $title_length : 60) : 60),
                    'comment_checkbox' => empty($stats_comments) ? false : $stats_comments,
                    'views_checkbox' => empty($stats_views) ? false : $stats_views,
                    'date_checkbox' => empty($stats_date) ? false : $stats_date,
                    'show_cat' => empty($category) ? false : true,
                    'cat_ids' => $category,
                    'date_format' => (in_array($stats_date_format, $stats_date_format_values)) ? $stats_date_format : 'format_three',
                    'show_thumbs' => empty($thumbnail_width) ? false : ((is_numeric($thumbnail_width)) ? (($thumbnail_width > 0) ? true : false) : false),
                    'width' => empty($thumbnail_width) ? 0 : ((is_numeric($thumbnail_width)) ? $thumbnail_width : 0),
                    'height' => empty($thumbnail_height) ? 0 : ((is_numeric($thumbnail_height)) ? $thumbnail_height : 0)
                );

    Would be nice to see this compatibility update on new release.

  • The topic ‘Unparenthesized `a ? b : c ? d : e` is not supported’ is closed to new replies.