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
]]>I just noticed that I’m seeing a huge white banner at the top of every page that uses HelpieFAQ with a warning “Warning: sizeof(): Parameter must be an array or an object that implements Countable in?/home/customer/www/[client’s url]/public_html/wp-content/plugins/helpie-faq/lib/widgetry/elementor-widget-base.php?on line?262”
I turned off debug mode and the warning disappeared. Thought I should let you know in case this causes bugs in the future.
]]>Warning: sizeof(): Parameter must be an array or an object that implements Countable in /web/htdocs/www.[website-link].com/home/wp-content/plugins/helpie-faq/lib/widgetry/elementor-widget-base.php on line 262
When I started working with the catalog everything was alright, now I added some products, categories and sub-categories and no products show up on the catalog page, just this 2 errors:
Warning: sizeof(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\wordpress-inventario-otbox\wp-content\plugins\ultimate-product-catalogue\Functions\Shortcodes.php on line 1826
Warning: sizeof(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\wordpress-inventario-otbox\wp-content\plugins\ultimate-product-catalogue\Functions\Shortcodes.php on line 1897
I went to check, and they are about the categories and sub-categories, here are only those lines:
line 1825 and 1826
// Create the categories checkboxes
if ($Sidebar_Item == “Categories” and sizeof($Categories) > 0) {
//
line 1896 and 1897
// Create the sub-categories checkboxes
if ($Sidebar_Item == “Sub-Categories” and sizeof($SubCategories) > 0 and $Sidebar_Order != “Hierarchical”) {
//
How can I solve this problem?
Edit: the php version is 7.3.5
]]>Warning: sizeof(): Parameter must be an array or an object that implements Countable in D:\webdev\wptest3\public_html\wp-content\plugins\resmushit-image-optimizer\classes\resmushit.class.php on line 356
PHP 7.2.0 with an empty Media Library.
]]>Warning: sizeof(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\wp-content\plugins\ultimate-product-catalogue\Functions\Shortcodes.php on line 1688
Is it possible to fix this and what should I do?
]]>