From LimeSurvey Manual


Working with a framework can sometimes be hard to debug. In Yii we have some tools at our disposal to help debug the application. The very first thing to do is modify application/config.php and to set debug = 2 at the end. Now we get more errors presented and we can use a trace function to see what a variable's content is at any time during program execution.

If you want to see what queries are sent to the database, you can also enable debugsql by setting it to 1.

To do a dump of a variable you can use the following syntax:

$variable = $this->someMethod();  // What would this return?

Yii::trace(CVarDumper:dumpAsString($variable), 'vardump');

We make use of the Yii<center>trace() method, and pass it the result of the static call to CVarDumper</center>dumpAsString(). What it does is is similar to var_dump but it allows a little more control if you need if. The second parameter 'vardump' makes sure our messages gets logged. All this is a lot of typing and since programmers are lazy, we created a global function to save you some trouble. Instead of the lines above you can also use:


As a bonus you will also get the file and line that called the traceVar function to assist in debugging.