Fatal error when updated wordpress

after i updated plygins and wordpress i receive this comment for all products:

Catchable fatal error: Object of class stdClass could not be converted to string in /homepages/13/d494606487/htdocs/caledoniansigns/wordpress/wp-content/themes/minshop/theme-functions.php on line 932

line 932 is this

$val = esc_html( str_replace('"', '\'', $val) );

code:

function themify_json_esc_array(&$arr_r) {
	if(is_array($arr_r)) {
		foreach ($arr_r as &$val) {
			if(is_array($val)) {
				themify_json_esc_array($val);
			} else {
				$val = esc_html( str_replace('"', '\'', $val) );
			}
			unset($val);
		}
	} else {
		$arr_r = esc_html( str_replace('"', '\'', $val) );
	}
}

You can comment out that function completely if you are not using the WordPress Rest API or you can log an issue with the theme developer. That is the quickest solution.

Alternatively, you can enable debugging: https://codex.wordpress.org/Debugging_in_WordPress

And then provide me with the detailed error message. It seems there is a problem converting something to a string.

1 Like

My guess

	if(is_array($arr_r)) {
.....
	} else {
		$arr_r = esc_html( str_replace('"', '\'', $val) );
	}

$arr_r is not an array, $val is undefined so str_replace does not return the string needed by esc_html

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.