Monday, July 21, 2014

CI 2.1.2 Profiler shows Warning at line 509, expected string got Object

Just want to note what i just found a bug of CI 2.1.2 in system/library/Profiler.php.
Where the $val is not evaluated to is_object and only expecting is_string() or is_array().
With no validation of is_object() the profiler triggers warning and it is ugly :D

Adding validation is_object() would fixed the warning.

at line 509:
Current:
if (is_array($val) )
{
$val = print_r($val, TRUE);
}

Patched:
if (is_array($val) or is_object( $val))
{
$val = print_r($val, TRUE);

}

No comments: