• When YITH Product Filter plugin is activated, on adding a product (edit-product.php) below Array is parsed into the urlencode() function from formatting line 4695 and causes below error:

    Warning: urlencode() expects parameter 1 to be string, array given in /homepages/10/d622714196/htdocs/clickandbuilds/OoOCAZ/wp-includes/formatting.php on line 4695

    Array
    (
        [0] => 1528
    )
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author YITHEMES

    (@yithemes)

    hi @dannykater,

    you use the latest version of product filter plugin ?
    I tested the plugin in local installation but this problem doesn’t appears.

    Let me know.
    Have a nice day
    YITH

    Thread Starter dannykater

    (@dannykater)

    Hi YITH,

    Yes my plugin is up to date. Just updated again.

    Now the product gets the right category, but still showing this error when YITH Product Filter Plugin is activated.

    Warning: urlencode() expects parameter 1 to be string, array given in /homepages/44/d643316445/htdocs/clickandbuilds/Surfsnb/wp-includes/formatting.php on line 4695

    nnyorker

    (@nnyorker)

    Any luck with this? Same problem.

    Thread Starter dannykater

    (@dannykater)

    For now I just edited WP’s wp-includes/formatting.php from line 4694 and added:

    	$array = $path;
    	$can_foreach = is_array($array) || is_object($array);
    	if ($can_foreach) {
    		foreach ($array as $single_path){
    			$path = $single_path;
    		}
    	}

    This changes the array to an string. Will be removed once WP is updated, so hope that YITH can reproduce the error and solve it asap.

    Cheers.

    @yithemes

    Hello dear support

    The same issue. @dannykater – proposed temporary solution which is not work in my case.

    I use Dash Theme + WC Vendors Pro plugin + YITH WooCommerce Ajax Product Filter.

    When YITH Product Filter plugin is activated, on adding a product (edit-product.php) below Array is parsed into the urlencode() function from formatting line 4695 and causes below error:

    Warning: urlencode() expects parameter 1 to be string, array given in /homepages/10/d622714196/htdocs/clickandbuilds/OoOCAZ/wp-includes/formatting.php on line 4695

    Are you going to solve the issue or i should find another solution independent of you?

    Added

    It appears if add Attributes, or add Categories

    Thread Starter dannykater

    (@dannykater)

    @localbrands, just to clearify:

    You have to replace from

    function wp_basename( $path, $suffix = '' ) {

    to

    return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
    }

    with

    function wp_basename( $path, $suffix = '' ) {
    	$array = $path;
    	$can_foreach = is_array($array) || is_object($array);
    	if ($can_foreach) {
    		foreach ($array as $single_path){
    			$path = $single_path;
    		}
    	}
    	return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
    }

    Please let me know if this works for you.

    And same question to YITH from me. I see you’ve done an update? Is this solved in this update?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Bug Array parsed into urlencode()’ is closed to new replies.