You can clone with
A PHP Error was encountered
Message: htmlspecialchars() expects parameter 1 to be string, object given
Line Number: 456
Add is_object to the conditional so that it prints the object as a string the same way it does for arrays.
if (is_array($val) || is_object($val))
$val = print_r($val, TRUE);
Thanks for this post. At least I was able to create a MY_Profiler class that extends the core version with your fix. Yes, just a warning but not optimal nor is the warning appealing when developing.