WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Warning: array_keys() expects parameter 1 to be array, null given in /…/wp-inc

[Resolved] Warning: array_keys() expects parameter 1 to be array, null given in /…/wp-inc

  • Hello,

    On WooCommerce 2.0.14 / WordPress 3.6.1

    I’ve got these warnings when displaying a product category list page :

    Warning: array_keys() expects parameter 1 to be array, null given in /.../wp-includes/taxonomy.php on line 2959
    Call Stack
    #	Time	Memory	Function	Location
    1	0.0001	232472	{main}( )	../index.php:0
    2	0.0002	235160	require( '/.../wp-blog-header.php' )	../index.php:17
    3	0.3220	20552928	require_once( '/.../wp-includes/template-loader.php' )	../wp-blog-header.php:16
    4	0.3256	20501480	include( '/.../wp-content/plugins/woocommerce/templates/taxonomy-product_cat.php' )	../template-loader.php:47
    5	0.3256	20501600	woocommerce_get_template( )	../taxonomy-product_cat.php:14
    6	0.3257	20513328	include( '/.../wp-content/plugins/woocommerce/templates/archive-product.php' )	../woocommerce-core-functions.php:633
    7	0.4866	21449664	woocommerce_product_subcategories( )	../archive-product.php:48
    8	0.4869	21453240	get_categories( )	../woocommerce-template.php:1152
    9	0.4870	21454544	get_terms( )	../category.php:51
    10	0.4898	21527352	_pad_term_counts( )	../taxonomy.php:1426
    11	0.4900	21532584
    array_keys
    ( )	../taxonomy.php:2959
    
    ( ! ) Warning: implode(): Invalid arguments passed in /.../wp-includes/taxonomy.php on line 2959
    Call Stack
    #	Time	Memory	Function	Location
    1	0.0001	232472	{main}( )	../index.php:0
    2	0.0002	235160	require( '/.../wp-blog-header.php' )	../index.php:17
    3	0.3220	20552928	require_once( '/.../wp-includes/template-loader.php' )	../wp-blog-header.php:16
    4	0.3256	20501480	include( '/.../wp-content/plugins/woocommerce/templates/taxonomy-product_cat.php' )	../template-loader.php:47
    5	0.3256	20501600	woocommerce_get_template( )	../taxonomy-product_cat.php:14
    6	0.3257	20513328	include( '/.../wp-content/plugins/woocommerce/templates/archive-product.php' )	../woocommerce-core-functions.php:633
    7	0.4866	21449664	woocommerce_product_subcategories( )	../archive-product.php:48
    8	0.4869	21453240	get_categories( )	../woocommerce-template.php:1152
    9	0.4870	21454544	get_terms( )	../category.php:51
    10	0.4898	21527352	_pad_term_counts( )	../taxonomy.php:1426
    11	0.4910	21532584
    implode
    ( )	../taxonomy.php:2959
    
    ( ! ) Warning: Invalid argument supplied for foreach() in /.../wp-includes/taxonomy.php on line 2966
    Call Stack
    #	Time	Memory	Function	Location
    1	0.0001	232472	{main}( )	../index.php:0
    2	0.0002	235160	require( '/.../wp-blog-header.php' )	../index.php:17
    3	0.3220	20552928	require_once( '/.../wp-includes/template-loader.php' )	../wp-blog-header.php:16
    4	0.3256	20501480	include( '/.../wp-content/plugins/woocommerce/templates/taxonomy-product_cat.php' )	../template-loader.php:47
    5	0.3256	20501600	woocommerce_get_template( )	../taxonomy-product_cat.php:14
    6	0.3257	20513328	include( '/.../wp-content/plugins/woocommerce/templates/archive-product.php' )	../woocommerce-core-functions.php:633
    7	0.4866	21449664	woocommerce_product_subcategories( )	../archive-product.php:48
    8	0.4869	21453240	get_categories( )	../woocommerce-template.php:1152
    9	0.4870	21454544	get_terms( )	../category.php:51
    10	0.4898	21527352	_pad_term_counts( )	../taxonomy.php:1426

    I’m not sure if it’s a bug with WordPress or WooCommerce.

    The messages disapears when i do one of the following :

    * /wp-content/plugins/woocommerce/woocommerce-template.php line 1149, if I set pad_counts to 0 just before $product_categories = get_categories( apply_filters( ‘woocommerce_product_subcategories_args’, $args ) );
    * /wp-includes/taxonomy.php, line 2949, if I replace $term_items = array(); with $term_items = $term_ids = array();

    I guess this problems comes in some particular context, but I’ve not understood yet what creates these warnings

    Any idea of what’s wrong ?

    http://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Well it looks like there was some funky problem with the category, deleted it and recreated another one solved the problem.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Warning: array_keys() expects parameter 1 to be array, null given in /…/wp-inc’ is closed to new replies.