CodeIgniter Forums
Output Profiler always displaying - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Output Profiler always displaying (/showthread.php?tid=39572)



Output Profiler always displaying - El Forum - 03-15-2011

[eluser]iloveci[/eluser]
Hello,

In my controller constructors I've got $this->output->enable_profiler($var); where $var = a value taken from the db either true or false. The problem is no matter what I put as $var, true, false, 1, 0 it always displays the profiler.

Is this a bug with the profiler output or what? I've tested/double/triple checked that $var is outputting a bool result.


Output Profiler always displaying - El Forum - 03-15-2011

[eluser]danmontgomery[/eluser]
For some reason enable_profiler() explicitly checks for a bool, you may need to typecast the value.

Code:
$this->output->enable_profiler((bool)$var);

Or, you could always just check the value of $var beforehand.

Code:
if($var) {
    $this->output->enable_profiler();
}



Output Profiler always displaying - El Forum - 03-17-2011

[eluser]iloveci[/eluser]
Thanks for the suggestion, I ended up typecasting the value and its working now.