Uncaught TypeError: sizeof() Fatal error occuring
-
Hi
I get following fatal error when a product category does not have any product. I had to patch the plugin which fixes the issue.
PHP Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, null given in /nas/content/live/pistilflowers/wp-content/plugins/wc-ajax-product-filter/wcapf.php:782\nStack trace:\n#0 /nas/content/live/pistilflowers/wp-content/plugins/wc-ajax-product-filter/widgets/widget-price-filter.php(34): WCAPF->getPriceRange(true)\n#1 /nas/content/live/pistilflowers/wp-includes/class-wp-widget.php(393): WCAPF_Price_Filter_Widget->widget(Array, Array)\n#2 /nas/content/live/pistilflowers/wp-includes/widgets.php(831): WP_Widget->display_callback(Array, Array)\n#3
…..`<strong>Solution</strong>
Change Line #782 in wc-ajax-product-filter/wcapf.php from
if (sizeof($price_range) > 1) {
To
if ($price_range != null && sizeof($price_range) > 1) {
I hope it will help someone.
Thanks
- The topic ‘Uncaught TypeError: sizeof() Fatal error occuring’ is closed to new replies.