Yii:die() , Yii:varDump()

2 quickies

Yii:die() - In a view since the output is buffered if you try to debug something with a die() you get an empty screen, is it possible to add a Yii::die function that does something like

echo ob_get_contents();


Yii:varDump - Loved prado varDump , can this be added into the Yii framework ?



You can use Yii::app()->end().

However, I think even if the output is buffered, calling die() should still display the buffered content.

Please create a ticket for varDump. Will add it.


Ticket added for varDump.

I had encountered issues with the output not appearing in different frameworks that used a similar buffering technique. But your right it appears to work fine right now. On this page http://ca.php.net/ref.outcontrol there is a comment on the issue that suggested ob_end_flush() is the default call.


As Yii::varDump() is usually only needed for print_r debugging, would it make sense to put it in something like a CDebugUtility class which isn't loaded into memory by default, and chuck something in the autoload function?

All framework classes are loaded on demand. So there is no waste here.

It would be loaded into memory all the time if it was a part of YiiBase though, that's why I was suggesting something like CDebugUtility. I'm looking at the autoload and import stuff at the moment - it's quite nice.

Not really. (This is true for Prado, but not for Yii).

When you call import() in Yii, it doesn't include the file immediately. The file will only be included when needed.

Yep, I follow you there. All i'm really suggesting is that varDump not be added to YiiBase because YiiBase is always included. If the varDump method is added to YiiBase (like in PradoBase), then it will also always be included. I just think it should be in a separate class so it can take advantage of the load on demand functionality you mention.