<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.limesurvey.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tuncerd</id>
	<title>LimeSurvey Manual - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.limesurvey.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tuncerd"/>
	<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/Special:Contributions/Tuncerd"/>
	<updated>2026-08-12T05:21:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Debugging&amp;diff=137630</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Debugging&amp;diff=137630"/>
		<updated>2019-03-11T16:32:50Z</updated>

		<summary type="html">&lt;p&gt;Tuncerd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=Debugging=&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;&#039;application/config/config-defaults.php&#039;&#039;&#039; and to set [[Optional_settings#Development_and_debugging|debug = 2]] at the end. Now we get more errors presented and we can use a trace function to see what a variable&#039;s content is at any time during program execution.&lt;br /&gt;
&lt;br /&gt;
If you want to see what queries are sent to the database, you can also enable debugsql by setting it to 1.&lt;br /&gt;
&lt;br /&gt;
To do a dump of a variable you can use the following syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$variable = $this-&amp;gt;someMethod();  // What would this return?&lt;br /&gt;
&lt;br /&gt;
Yii&amp;lt;center&amp;gt;trace(CVarDumper&amp;lt;/center&amp;gt;dumpAsString($variable), &#039;vardump&#039;);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We make use of the &amp;lt;nowiki&amp;gt;Yii&amp;lt;center&amp;gt;trace()&amp;lt;/nowiki&amp;gt; method, and pass it the result of the static call to &amp;lt;nowiki&amp;gt;CVarDumper&amp;lt;/center&amp;gt;dumpAsString()&amp;lt;/nowiki&amp;gt;. What it does is similar to var_dump but it allows a little more control if you need it. The second parameter &#039;vardump&#039; 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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;traceVar($variable);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a bonus you will also get the file and line that called the traceVar function to assist in debugging.&lt;/div&gt;</summary>
		<author><name>Tuncerd</name></author>
	</entry>
	<entry>
		<id>https://www.limesurvey.org/manual/index.php?title=Debugging&amp;diff=137561</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://www.limesurvey.org/manual/index.php?title=Debugging&amp;diff=137561"/>
		<updated>2019-03-11T08:41:38Z</updated>

		<summary type="html">&lt;p&gt;Tuncerd: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=Debugging=&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;&#039;application/config.php&#039;&#039;&#039; and to set [[Optional_settings#Development_and_debugging|debug = 2]] at the end. Now we get more errors presented and we can use a trace function to see what a variable&#039;s content is at any time during program execution.&lt;br /&gt;
&lt;br /&gt;
If you want to see what queries are sent to the database, you can also enable debugsql by setting it to 1.&lt;br /&gt;
&lt;br /&gt;
To do a dump of a variable you can use the following syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;$variable = $this-&amp;gt;someMethod();  // What would this return?&lt;br /&gt;
&lt;br /&gt;
Yii&amp;lt;center&amp;gt;trace(CVarDumper&amp;lt;/center&amp;gt;dumpAsString($variable), &#039;vardump&#039;);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We make use of the &amp;lt;nowiki&amp;gt;Yii&amp;lt;center&amp;gt;trace()&amp;lt;/nowiki&amp;gt; method, and pass it the result of the static call to &amp;lt;nowiki&amp;gt;CVarDumper&amp;lt;/center&amp;gt;dumpAsString()&amp;lt;/nowiki&amp;gt;. What it does is similar to var_dump but it allows a little more control if you need it. The second parameter &#039;vardump&#039; 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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot; enclose=&amp;quot;div&amp;quot;&amp;gt;traceVar($variable);&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a bonus you will also get the file and line that called the traceVar function to assist in debugging.&lt;/div&gt;</summary>
		<author><name>Tuncerd</name></author>
	</entry>
</feed>