PageRenderTime 29ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/html/docs/include/features.php

https://github.com/WouterJ/xdebug.org
PHP | 1414 lines | 1400 code | 12 blank | 2 comment | 3 complexity | e5224c4eab9eb1948c7850a35ef80fcb MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. $features = array(
  3. 'all_functions' => array(
  4. 'All Functions',
  5. FUNC_ALL,
  6. 'This section describes all available functions available in Xdebug.',
  7. ''
  8. ),
  9. 'all_settings' => array(
  10. 'All Settings',
  11. FUNC_ALL,
  12. 'This section describes all available configuration settings available in Xdebug.',
  13. ''
  14. ),
  15. 'all' => array(
  16. 'The full documentation',
  17. FUNC_ALL,
  18. '',
  19. ''
  20. ),
  21. 'install' => array(
  22. 'Installation',
  23. FUNC_INSTALL,
  24. 'This section describes on how to install Xdebug.',
  25. "
  26. <h2>Precompiled Windows Modules</h2>
  27. <p>
  28. There are a few precompiled modules for Windows, they are all for the non-debug
  29. version of PHP. You can get those at the <a href='/download.php'>download</a>
  30. page. Follow <a href='/wizard.php'>these instructions</a> to get Xdebug
  31. installed.
  32. </p>
  33. <a name='pecl'></a>
  34. <h2>PECL Installation</h2>
  35. <p>
  36. As of Xdebug 0.9.0 you can install Xdebug through PEAR/PECL. This only works
  37. with with PEAR version 0.9.1-dev or higher and some UNIX.
  38. </p>
  39. <p>
  40. Installing with PEAR/PECL is as easy as:
  41. </p>
  42. <pre>
  43. # pecl install xdebug
  44. </pre>
  45. <p>
  46. but you still need to add the correct line to your php.ini: (don't forget to
  47. change the path and filename to the correct one &mdash; but make sure you use
  48. the <b>full path</b>)
  49. </p>
  50. <pre>
  51. zend_extension=\"/usr/local/php/modules/xdebug.so\"
  52. </pre>
  53. <p><b>Note:</b> You should ignore any prompts to add \"extension=xdebug.so\" to
  54. php.ini &mdash; this <b>will</b> cause problems.</p>
  55. <a name='source'></a>
  56. <h2>Installation From Source</h2>
  57. <p>
  58. You can <a href='/download.php#releases'>download</a> the source of the latest <b>stable</b> release [KW:last_release_version].
  59. Alternatively you can obtain Xdebug from GIT:
  60. </p>
  61. <pre>
  62. git clone git://github.com/xdebug/xdebug.git
  63. </pre>
  64. <p>
  65. This will checkout the latest development version which is currently [KW:last_dev_version].
  66. You can also browse the source at <a href='https://github.com/derickr/xdebug'>https://github.com/derickr/xdebug</a>.
  67. </p>
  68. <a name='compile'></a>
  69. <h2>Compiling</h2>
  70. <p>There is a <a href='/wizard.php'>wizard</a> available that provides you
  71. with the correct file to download, and which paths to use.</p>
  72. <p>
  73. You compile Xdebug separately from the rest of PHP. Note, however,
  74. that you need access to the scripts 'phpize' and 'php-config'. If
  75. your system does not have 'phpize' and 'php-config', you will need to
  76. compile and install PHP from a source tarball first, as these script
  77. are by-products of the PHP compilation and installation processes. (Debian users
  78. can install the required tools with
  79. <code>apt-get install php5-dev</code>). It is important that the source version
  80. matches the installed version as there are slight, but important, differences
  81. between PHP versions. Once you have access to 'phpize' and
  82. 'php-config', do the following:
  83. </p>
  84. <p>
  85. <ol>
  86. <li>Unpack the tarball: tar -xzf xdebug-[KW:last_release_version].tgz. Note that you do
  87. not need to unpack the tarball inside the PHP source code tree.
  88. Xdebug is compiled separately, all by itself, as stated above.</li>
  89. <li>cd xdebug-[KW:last_release_version]</li>
  90. <li>Run phpize: phpize (or /path/to/phpize if phpize is not in your path). Make
  91. sure you use the phpize that belongs to the PHP version that you want to use
  92. Xdebug with. See this <a href='/docs/faq#api'>FAQ entry</a> if
  93. you're having some issues with finding which phpize to use.</li>
  94. <li>./configure --enable-xdebug
  95. <li>make</li>
  96. <li>make install</li>
  97. </ol>
  98. <a name='configure-php'></a>
  99. <h2>Configure PHP to Use Xdebug</h2>
  100. <ol>
  101. <li>add the following line to php.ini:
  102. zend_extension=\"/wherever/you/put/it/xdebug.so\" (for non-threaded use of PHP,
  103. for example the CLI, CGI or Apache 1.3 module) or:
  104. zend_extension_ts=\"/wherever/you/put/it/xdebug.so\" (for threaded usage of PHP,
  105. for example the Apache 2 work MPM or the the ISAPI module).
  106. <strong>Note:</strong> In case you compiled PHP yourself and used
  107. --enable-debug you would have to use zend_extension_debug=.
  108. <strong>From PHP 5.3 onwards, you always need to use the zend_extension PHP.ini
  109. setting name, and not zend_extension_ts, nor zend_extension_debug. However,
  110. your compile options (ZTS/normal build; debug/non-debug) still need to match
  111. with what PHP is using.</strong>
  112. </li>
  113. <li>Restart your webserver.</li>
  114. <li>Write a PHP page that calls '<i>phpinfo()</i>' Load it in a browser and
  115. look for the info on the Xdebug module. If you see it next to the Zend logo,
  116. you have been successful! You can also use 'php -m' if you have a command
  117. line version of PHP, it lists all loaded modules. Xdebug should appear
  118. twice there (once under 'PHP Modules' and once under 'Zend Modules').</li>
  119. </ol>
  120. </p>
  121. <a name='compat'></a>
  122. <h2>Compatibility</h2>
  123. <p>
  124. Xdebug does not work together with the Zend Optimizer or any other extension
  125. that deals with PHP's internals (DBG, APD, ioncube etc). This is due to
  126. compatibility problems with those modules.
  127. </p>
  128. <a name='debugclient'></a>
  129. <h2>Debugclient Installation</h2>
  130. <p>
  131. Unpack the Xdebug source tarball and issue the following commands:
  132. </p>
  133. <pre class='example'>
  134. $ cd debugclient
  135. $ ./configure --with-libedit
  136. $ make
  137. # make install
  138. </pre>
  139. <p>
  140. This will install the debugclient binary in /usr/local/bin unless you don't
  141. have libedit installed on your system. You can either install it, or leave
  142. out the '--with-libedit' option to configure. Debian 'unstable' users can
  143. install the library with <code>apt-get install libedit-dev libedit2</code>.
  144. </p>
  145. <p>
  146. If the configure script can not find libedit and you are sure you have (and
  147. it's headers) installed correctly and you get link errors like the
  148. following in your configure.log:
  149. </p>
  150. <pre class='example'>
  151. /usr/lib64/libedit.so: undefined reference to `tgetnum'
  152. /usr/lib64/libedit.so: undefined reference to `tgoto'
  153. /usr/lib64/libedit.so: undefined reference to `tgetflag'
  154. /usr/lib64/libedit.so: undefined reference to `tputs'
  155. /usr/lib64/libedit.so: undefined reference to `tgetent'
  156. /usr/lib64/libedit.so: undefined reference to `tgetstr'
  157. collect2: ld returned 1 exit status
  158. </pre>
  159. <p>
  160. you need to change your configure command to:
  161. </p>
  162. <pre class='example'>
  163. $ LDFLAGS=-lncurses ./configure --with-libedit
  164. </pre>"
  165. ),
  166. 'basic' => array(
  167. 'Basic Features',
  168. FUNC_BASIC,
  169. 'Xdebug\'s basic functions include the display of stack traces on error
  170. conditions, maximum nesting level protection and time tracking.',
  171. ""
  172. ),
  173. 'display' => array(
  174. 'Variable Display Features',
  175. FUNC_VAR_DUMP,
  176. 'Xdebug replaces PHP\'s var_dump() function for displaying variables.
  177. Xdebug\'s version includes different colors for different types and
  178. places limits on the amount of array elements/object properties,
  179. maximum depth and string lengths. There are a few other functions
  180. dealing with variable display as well.',
  181. '
  182. <h2>Effect of settings on var_dump()</h2>
  183. <p>
  184. There is a number of settings that control the output of Xdebug\'s modified
  185. [FUNC:var_dump] function: [CFG:var_display_max_children],
  186. [CFG:var_display_max_data]
  187. and [CFG:var_display_max_depth]. The effect of these three settings is best
  188. shown with an example. The script below is run four time, each time with
  189. different settings. You can use the tabs to see the difference.
  190. </p>
  191. <h3>The script</h3>
  192. <div class="example">
  193. <p>
  194. <code><span style="color: #000000">
  195. <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;</span><span style="color: #0000BB">$pub&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;</span><span style="color: #0000BB">$priv&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;</span><span style="color: #0000BB">$prot&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">42</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">$t&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">test</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$t</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">pub&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'one\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">\'a&nbsp;somewhat&nbsp;long&nbsp;string!\'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one.zero\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">210</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one.one\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one.one.zero\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">3.141592564</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'two.one.one.one\'&nbsp;&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">2.7</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<br />&nbsp;&nbsp;&nbsp;&nbsp;),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'three\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">\'four\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">range</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">),<br />);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span>
  196. </span>
  197. </code>
  198. </p>
  199. </div>
  200. <h3>The results</h3>
  201. <div id="demosettings" class="yui-navset">
  202. <ul class="yui-nav">
  203. <li class="selected"><a href="#default"><em>default</em></a></li>
  204. <li><a href="#children"><em>children=2</em></a></li>
  205. <li><a href="#data"><em>data=16</em></a></li>
  206. <li><a href="#depth"><em>depth=2</em></a></li>
  207. <li><a href="#multiple"><em>children=3, data=8, depth=1</em></a></li>
  208. </ul>
  209. <div class="yui-content">
  210. <div id="default">
  211. <pre>
  212. <b>array</b>
  213. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewhat long string!\'</font> <i>(length=23)</i>
  214. \'two\' <font color=\'#888a85\'>=&gt;</font>
  215. <b>array</b>
  216. \'two.one\' <font color=\'#888a85\'>=&gt;</font>
  217. <b>array</b>
  218. \'two.one.zero\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>210</font>
  219. \'two.one.one\' <font color=\'#888a85\'>=&gt;</font>
  220. <b>array</b>
  221. ...
  222. \'three\' <font color=\'#888a85\'>=&gt;</font>
  223. <b>object</b>(<i>test</i>)[<i>1</i>]
  224. <i>public</i> \'pub\' <font color=\'#888a85\'>=&gt;</font>
  225. <i>&</i><b>object</b>(<i>test</i>)[<i>1</i>]
  226. <i>private</i> \'priv\' <font color=\'#888a85\'>=&gt;</font> <small>boolean</small> <font color=\'#75507b\'>true</font>
  227. <i>protected</i> \'prot\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>42</font>
  228. \'four\' <font color=\'#888a85\'>=&gt;</font>
  229. <b>array</b>
  230. 0 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>0</font>
  231. 1 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>1</font>
  232. 2 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>2</font>
  233. 3 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>3</font>
  234. 4 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>4</font>
  235. 5 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>5</font>
  236. </pre>
  237. </div>
  238. <div id="children">
  239. <pre>
  240. <b>array</b>
  241. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewhat long string!\'</font> <i>(length=23)</i>
  242. \'two\' <font color=\'#888a85\'>=&gt;</font>
  243. <b>array</b>
  244. \'two.one\' <font color=\'#888a85\'>=&gt;</font>
  245. <b>array</b>
  246. \'two.one.zero\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>210</font>
  247. \'two.one.one\' <font color=\'#888a85\'>=&gt;</font>
  248. <b>array</b>
  249. ...
  250. <i>more elements...</i>
  251. </pre>
  252. </div>
  253. <div id="data">
  254. <pre>
  255. <b>array</b>
  256. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewhat long \'...</font> <i>(length=23)</i>
  257. \'two\' <font color=\'#888a85\'>=&gt;</font>
  258. <b>array</b>
  259. \'two.one\' <font color=\'#888a85\'>=&gt;</font>
  260. <b>array</b>
  261. \'two.one.zero\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>210</font>
  262. \'two.one.one\' <font color=\'#888a85\'>=&gt;</font>
  263. <b>array</b>
  264. ...
  265. \'three\' <font color=\'#888a85\'>=&gt;</font>
  266. <b>object</b>(<i>test</i>)[<i>1</i>]
  267. <i>public</i> \'pub\' <font color=\'#888a85\'>=&gt;</font>
  268. <i>&</i><b>object</b>(<i>test</i>)[<i>1</i>]
  269. <i>private</i> \'priv\' <font color=\'#888a85\'>=&gt;</font> <small>boolean</small> <font color=\'#75507b\'>true</font>
  270. <i>protected</i> \'prot\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>42</font>
  271. \'four\' <font color=\'#888a85\'>=&gt;</font>
  272. <b>array</b>
  273. 0 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>0</font>
  274. 1 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>1</font>
  275. 2 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>2</font>
  276. 3 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>3</font>
  277. 4 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>4</font>
  278. 5 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>5</font>
  279. </pre>
  280. </div>
  281. <div id="depth">
  282. <pre>
  283. <b>array</b>
  284. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewhat long string!\'</font> <i>(length=23)</i>
  285. \'two\' <font color=\'#888a85\'>=&gt;</font>
  286. <b>array</b>
  287. \'two.one\' <font color=\'#888a85\'>=&gt;</font>
  288. <b>array</b>
  289. ...
  290. \'three\' <font color=\'#888a85\'>=&gt;</font>
  291. <b>object</b>(<i>test</i>)[<i>1</i>]
  292. <i>public</i> \'pub\' <font color=\'#888a85\'>=&gt;</font>
  293. <i>&</i><b>object</b>(<i>test</i>)[<i>1</i>]
  294. <i>private</i> \'priv\' <font color=\'#888a85\'>=&gt;</font> <small>boolean</small> <font color=\'#75507b\'>true</font>
  295. <i>protected</i> \'prot\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>42</font>
  296. \'four\' <font color=\'#888a85\'>=&gt;</font>
  297. <b>array</b>
  298. 0 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>0</font>
  299. 1 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>1</font>
  300. 2 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>2</font>
  301. 3 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>3</font>
  302. 4 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>4</font>
  303. 5 <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>5</font>
  304. </pre>
  305. </div>
  306. <div id="multiple">
  307. <pre>
  308. <b>array</b>
  309. \'one\' <font color=\'#888a85\'>=&gt;</font> <small>string</small> <font color=\'#cc0000\'>\'a somewh\'...</font> <i>(length=23)</i>
  310. \'two\' <font color=\'#888a85\'>=&gt;</font>
  311. <b>array</b>
  312. ...
  313. \'three\' <font color=\'#888a85\'>=&gt;</font>
  314. <b>object</b>(<i>test</i>)[<i>1</i>]
  315. ...
  316. <i>more elements...</i>
  317. </pre>
  318. </div>
  319. </div>
  320. </div>',
  321. array( 'tabfields' => array( 'demosettings' ) )
  322. ),
  323. 'stack_trace' => array(
  324. 'Stack Traces',
  325. FUNC_STACK_TRACE,
  326. 'When Xdebug is activated it will show a stack trace whenever PHP
  327. decides to show a notice, warning, error etc. The information that
  328. stack traces display, and the way how they are presented, can be
  329. configured to suit your needs.',
  330. '
  331. <p>
  332. The stack traces that Xdebug shows on error situations (if <a
  333. href="http://www.php.net/manual/en/ref.errorfunc.php#ini.display-errors">display_errors</a>
  334. is set to On in php.ini) are quite conservative in the amount of
  335. information that they show. This is because large amounts of information can
  336. slow down both the execution of the scripts and the rendering of the stack
  337. traces themselves in the browser. However, it is possible to make the stack
  338. traces show more detailed information with different settings.
  339. </p>
  340. <h2>Variables in Stack Traces</h2>
  341. <p>
  342. By default Xdebug will now show variable information in the stack traces that
  343. it produces. Variable information can take quite a bit of resources, both while
  344. collecting or displaying. However, in many cases it is useful that variable
  345. information is displayed, and that is why Xdebug has the setting
  346. [CFG:collect_params]. The script below, in combination with what the output
  347. will look like with different values of this setting is shown in the example
  348. below.
  349. </p>
  350. <h3>The script</h3>
  351. <div class="example">
  352. <p>
  353. <code><span style="color: #000000">
  354. <span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">[</span><span style="color: #DD0000">\'foo\'</span><span style="color: #007700">];&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">==&nbsp;</span><span style="color: #0000BB">500000</span><span style="color: #007700">)&nbsp;</span><span style="color: #0000BB">xdebug_break</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">set_time_limit</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">stdClass</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bar&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">42&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">\'foo\'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">912124</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;new&nbsp;</span><span style="color: #0000BB">stdClass</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">\'/etc/passwd\'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">\'r\'&nbsp;</span><span style="color: #007700">)<br />);<br /></span><span style="color: #0000BB">foo</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$a&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span>
  355. </span>
  356. </code>
  357. </p>
  358. </div>
  359. <h3>The results</h3>
  360. <p>
  361. Different values for the [CFG:collect_params] setting give different output,
  362. which you can see below:
  363. </p>
  364. <div id="collectparams" class="yui-navset">
  365. <ul class="yui-nav">
  366. <li class="selected"><a href="#default"><em>default</em></a></li>
  367. <li><a href="#collect-params-1"><em>1</em></a></li>
  368. <li><a href="#collect-params-2"><em>2</em></a></li>
  369. <li><a href="#collect-params-3"><em>3</em></a></li>
  370. <li><a href="#collect-params-4"><em>4</em></a></li>
  371. </ul>
  372. <div class="yui-content">
  373. <div id="default">
  374. <br />
  375. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  376. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>34</i></th></tr>
  377. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  378. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  379. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58564</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  380. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62764</td><td bgcolor=\'#eeeeec\'>foo( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  381. </table></font>
  382. </div>
  383. <div id="collect-params-1">
  384. <pre>
  385. ini_set(\'xdebug.collect_params\', \'1\');
  386. </pre>
  387. <br />
  388. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  389. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  390. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  391. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  392. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58132</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  393. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62380</td><td bgcolor=\'#eeeeec\'>foo( <span><font color=\'#ce5c00\'>array(5)</font></span> )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  394. </table></font>
  395. </div>
  396. <div id="collect-params-2">
  397. <pre>
  398. ini_set(\'xdebug.collect_params\', \'2\');
  399. </pre>
  400. <br />
  401. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  402. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  403. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  404. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  405. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58564</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  406. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62812</td><td bgcolor=\'#eeeeec\'>foo( <span title=\'array (42 =&gt; FALSE, &apos;foo&apos; =&gt; 912124, 43 =&gt; class stdClass { public $bar = 100 }, 44 =&gt; class stdClass { }, 45 =&gt; resource(2) of type (stream))\'><font color=\'#ce5c00\'>array(5)</font></span> )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  407. </table></font>
  408. </div>
  409. <div id="collect-params-3">
  410. <pre>
  411. ini_set(\'xdebug.collect_params\', \'3\');
  412. </pre>
  413. <br />
  414. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  415. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  416. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  417. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  418. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58564</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  419. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62812</td><td bgcolor=\'#eeeeec\'>foo( <span>array (42 =&gt; FALSE, &apos;foo&apos; =&gt; 912124, 43 =&gt; class stdClass { public $bar = 100 }, 44 =&gt; class stdClass { }, 45 =&gt; resource(2) of type (stream))</span> )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  420. </table></font>
  421. </div>
  422. <div id="collect-params-4">
  423. <pre>
  424. ini_set(\'xdebug.collect_params\', \'4\');
  425. </pre>
  426. <br />
  427. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  428. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  429. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  430. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  431. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58132</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  432. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62380</td><td bgcolor=\'#eeeeec\'>foo( <span>$a = </span><span>array (42 =&gt; FALSE, &apos;foo&apos; =&gt; 912124, 43 =&gt; class stdClass { public $bar = 100 }, 44 =&gt; class stdClass { }, 45 =&gt; resource(2) of type (stream))</span> )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  433. </table></font>
  434. </div>
  435. </div>
  436. </div>
  437. <h2>Additional Information</h2>
  438. <p>
  439. On top of showing the values of variables that were passed to each function
  440. Xdebug can also optionally show information about selected superglobals by using
  441. the [CFG:dump_globals] and [CFG:dump.*] settings. The settings [CFG:dump_once]
  442. and [CFG:dump_undefined] slightly modify when and which information is shown
  443. from the available superglobals. With the [CFG:show_local_vars] setting you can
  444. instruct Xdebug to show all variables available in the top-most stack level for
  445. a user defined function as well. The examples below show this (the script is
  446. used from the example above).
  447. </p>
  448. <div id="othersettings" class="yui-navset">
  449. <ul class="yui-nav">
  450. <li class="selected"><a href="#add-default"><em>default</em></a></li>
  451. <li><a href="#add-superglobals"><em>dump_superglobals=1</em></a></li>
  452. <li><a href="#add-local-vars"><em>show_local_vars=1</em></a></li>
  453. </ul>
  454. <div class="yui-content">
  455. <div id="add-default">
  456. <br />
  457. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  458. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>34</i></th></tr>
  459. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  460. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  461. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58564</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  462. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62764</td><td bgcolor=\'#eeeeec\'>foo( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  463. </table></font>
  464. </div>
  465. <div id="add-superglobals">
  466. <pre>
  467. ini_set(\'xdebug.collect_vars\', \'on\');
  468. ini_set(\'xdebug.collect_params\', \'4\');
  469. ini_set(\'xdebug.dump_globals\', \'on\');
  470. ini_set(\'xdebug.dump.SERVER\', \'REQUEST_URI\');
  471. </pre>
  472. <br />
  473. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  474. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>33</i></th></tr>
  475. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  476. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  477. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58132</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  478. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0004</td><td bgcolor=\'#eeeeec\' align=\'right\'>62436</td><td bgcolor=\'#eeeeec\'>foo( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  479. <tr><th colspan=\'5\' align=\'left\' bgcolor=\'#e9b96e\'>Dump <i>$_SERVER</i></th></tr>
  480. <tr><td colspan=\'2\' align=\'right\' bgcolor=\'#eeeeec\' valign=\'top\'><pre>$_SERVER[\'REQUEST_URI\']&nbsp;=</pre></td><td colspan=\'3\' bgcolor=\'#eeeeec\'><pre><small>string</small> <font color=\'#cc0000\'>\'/test/xdebug/docs/stack.php?level=5\'</font> <i>(length=35)</i>
  481. </pre></td></tr>
  482. </table></font>
  483. </div>
  484. <div id="add-local-vars">
  485. <pre>
  486. ini_set(\'xdebug.collect_vars\', \'on\');
  487. ini_set(\'xdebug.collect_params\', \'4\');
  488. ini_set(\'xdebug.dump_globals\', \'on\');
  489. ini_set(\'xdebug.dump.SERVER\', \'REQUEST_URI\');
  490. ini_set(\'xdebug.show_local_vars\', \'on\');
  491. </pre>
  492. <br />
  493. <font size=\'1\'><table border=\'1\' cellspacing=\'0\' cellpadding=\'1\'>
  494. <tr><th align=\'left\' bgcolor=\'#f57900\' colspan="5"><span style=\'background-color: #cc0000; color: #fce94f; font-size: x-large;\'>( ! )</span> Fatal error: Maximum execution time of 1 second exceeded in /home/httpd/html/test/xdebug/docs/stack.php on line <i>31</i></th></tr>
  495. <tr><th align=\'left\' bgcolor=\'#e9b96e\' colspan=\'5\'>Call Stack</th></tr>
  496. <tr><th align=\'center\' bgcolor=\'#eeeeec\'>#</th><th align=\'left\' bgcolor=\'#eeeeec\'>Time</th><th align=\'left\' bgcolor=\'#eeeeec\'>Memory</th><th align=\'left\' bgcolor=\'#eeeeec\'>Function</th><th align=\'left\' bgcolor=\'#eeeeec\'>Location</th></tr>
  497. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>1</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0001</td><td bgcolor=\'#eeeeec\' align=\'right\'>58132</td><td bgcolor=\'#eeeeec\'>{main}( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>0</td></tr>
  498. <tr><td bgcolor=\'#eeeeec\' align=\'center\'>2</td><td bgcolor=\'#eeeeec\' align=\'center\'>0.0005</td><td bgcolor=\'#eeeeec\' align=\'right\'>62588</td><td bgcolor=\'#eeeeec\'>foo( )</td><td title=\'/home/httpd/html/test/xdebug/docs/stack.php\' bgcolor=\'#eeeeec\'>../stack.php<b>:</b>47</td></tr>
  499. <tr><th colspan=\'5\' align=\'left\' bgcolor=\'#e9b96e\'>Dump <i>$_SERVER</i></th></tr>
  500. <tr><td colspan=\'2\' align=\'right\' bgcolor=\'#eeeeec\' valign=\'top\'><pre>$_SERVER[\'REQUEST_URI\']&nbsp;=</pre></td><td colspan=\'3\' bgcolor=\'#eeeeec\'><pre><small>string</small> <font color=\'#cc0000\'>\'/test/xdebug/docs/stack.php?level=6\'</font> <i>(length=35)</i>
  501. </pre></td></tr>
  502. <tr><th align=\'left\' colspan=\'5\' bgcolor=\'#e9b96e\'>Variables in local scope (#2)</th></tr>
  503. <tr><td colspan=\'2\' align=\'right\' bgcolor=\'#eeeeec\' valign=\'top\'><pre>$a&nbsp;=</pre></td><td colspan=\'4\' bgcolor=\'#eeeeec\'><pre>
  504. <b>array</b>
  505. 42 <font color=\'#888a85\'>=&gt;</font> <small>boolean</small> <font color=\'#75507b\'>false</font>
  506. \'foo\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>912124</font>
  507. 43 <font color=\'#888a85\'>=&gt;</font>
  508. <b>object</b>(<i>stdClass</i>)[<i>1</i>]
  509. <i>public</i> \'bar\' <font color=\'#888a85\'>=&gt;</font> <small>int</small> <font color=\'#4e9a06\'>100</font>
  510. 44 <font color=\'#888a85\'>=&gt;</font>
  511. <b>object</b>(<i>stdClass</i>)[<i>2</i>]
  512. 45 <font color=\'#888a85\'>=&gt;</font> <b>resource</b>(<i>2</i><font color=\'#2e3436\'>,</font> <i>stream</i>)
  513. </pre></td></tr>
  514. <tr><td colspan=\'2\' align=\'right\' bgcolor=\'#eeeeec\' valign=\'top\'><pre>$i&nbsp;=</pre></td><td colspan=\'4\' bgcolor=\'#eeeeec\'><pre><small>int</small> <font color=\'#4e9a06\'>275447</font>
  515. </pre></td></tr>
  516. </table></font>
  517. </div>
  518. </div>
  519. </div>',
  520. array( 'tabfields' => array( 'collectparams', 'othersettings' ) )
  521. ),
  522. 'execution_trace' => array(
  523. 'Function Traces',
  524. FUNC_FUNCTION_TRACE,
  525. 'Xdebug allows you to log all function calls, including parameters and
  526. return values to a file in different formats.',
  527. '
  528. <p>
  529. Those so-called "function traces" can be a help for when you are new to an
  530. application or when you are trying to figure out what exactly is going on when
  531. your application is running. The function traces can optionally also show the
  532. values of variables passed to the functions and methods, and also return
  533. values. In the default traces those two elements are not available.
  534. </p>
  535. <h2>Output Formats</h2>
  536. <p>
  537. There are three output formats. One is meant as a human readable trace, another
  538. one is more suited for computer programs as it is easier to parse, and the last
  539. one uses HTML for formatting the trace. You can switch between the two
  540. different formats with the [CFG:trace_format] setting. There are a few settings
  541. that control which information is written to the trace files. There are
  542. settings for including variables ([CFG:collect_params]) and for including
  543. return values ([CFG:collect_return]) for example. The example below shows what
  544. effect the different settings have for the human readable function traces.
  545. </p>
  546. <h3>The Script</h3>
  547. <div class="example">
  548. <p>
  549. <code><span style="color: #000000">
  550. <span style="color: #0000BB">&lt;?php<br />$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Xdebug"</span><span style="color: #007700">;<br />function&nbsp;</span><span style="color: #0000BB">ret_ord</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">ord</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">);<br />}<br /><br />foreach&nbsp;(&nbsp;</span><span style="color: #0000BB">str_split</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$str&nbsp;</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$char&nbsp;</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$char</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">":&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">ret_ord</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$char&nbsp;</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;<br /></span>
  551. </span>
  552. </code>
  553. </p>
  554. </div>
  555. <h3>The Results</h3>
  556. <p>
  557. Below are the results with different settings of the [CFG:collect_params]
  558. setting. As this is not a web environment the value of 2 does not have any
  559. meaning as tool tips don\'t work in text files.
  560. </p>
  561. <div id="collectparams" class="yui-navset">
  562. <ul class="yui-nav">
  563. <li class="selected"><a href="#default1"><em>default</em></a></li>
  564. <li><a href="#collect-params-1"><em>collect_params=1</em></a></li>
  565. <li><a href="#collect-params-3"><em>collect_params=3</em></a></li>
  566. <li><a href="#collect-params-4"><em>collect_params=4</em></a></li>
  567. </ul>
  568. <div class="yui-content">
  569. <div id="default1">
  570. <pre class="shell">
  571. TRACE START [2007-05-06 14:37:06]
  572. 0.0003 114112 -> {main}() ../trace.php:0
  573. 0.0004 114272 -> str_split() ../trace.php:8
  574. 0.0153 117424 -> ret_ord() ../trace.php:10
  575. 0.0165 117584 -> ord() ../trace.php:5
  576. 0.0166 117584 -> ret_ord() ../trace.php:10
  577. 0.0167 117584 -> ord() ../trace.php:5
  578. 0.0168 117584 -> ret_ord() ../trace.php:10
  579. 0.0168 117584 -> ord() ../trace.php:5
  580. 0.0170 117584 -> ret_ord() ../trace.php:10
  581. 0.0170 117584 -> ord() ../trace.php:5
  582. 0.0172 117584 -> ret_ord() ../trace.php:10
  583. 0.0172 117584 -> ord() ../trace.php:5
  584. 0.0173 117584 -> ret_ord() ../trace.php:10
  585. 0.0174 117584 -> ord() ../trace.php:5
  586. 0.0177 41152
  587. TRACE END [2007-05-06 14:37:07]
  588. </pre>
  589. </div>
  590. <div id="collect-params-1">
  591. <pre class="shell">
  592. TRACE START [2007-05-06 14:37:11]
  593. 0.0003 114112 -> {main}() ../trace.php:0
  594. 0.0004 114272 -> str_split(string(6)) ../trace.php:8
  595. 0.0007 117424 -> ret_ord(string(1)) ../trace.php:10
  596. 0.0007 117584 -> ord(string(1)) ../trace.php:5
  597. 0.0009 117584 -> ret_ord(string(1)) ../trace.php:10
  598. 0.0009 117584 -> ord(string(1)) ../trace.php:5
  599. 0.0010 117584 -> ret_ord(string(1)) ../trace.php:10
  600. 0.0011 117584 -> ord(string(1)) ../trace.php:5
  601. 0.0012 117584 -> ret_ord(string(1)) ../trace.php:10
  602. 0.0013 117584 -> ord(string(1)) ../trace.php:5
  603. 0.0014 117584 -> ret_ord(string(1)) ../trace.php:10
  604. 0.0014 117584 -> ord(string(1)) ../trace.php:5
  605. 0.0016 117584 -> ret_ord(string(1)) ../trace.php:10
  606. 0.0016 117584 -> ord(string(1)) ../trace.php:5
  607. 0.0019 41152
  608. TRACE END [2007-05-06 14:37:11]
  609. </pre>
  610. </div>
  611. <div id="collect-params-3">
  612. <pre class="shell">
  613. TRACE START [2007-05-06 14:37:13]
  614. 0.0003 114112 -> {main}() ../trace.php:0
  615. 0.0004 114272 -> str_split(\'Xdebug\') ../trace.php:8
  616. 0.0007 117424 -> ret_ord(\'X\') ../trace.php:10
  617. 0.0007 117584 -> ord(\'X\') ../trace.php:5
  618. 0.0009 117584 -> ret_ord(\'d\') ../trace.php:10
  619. 0.0009 117584 -> ord(\'d\') ../trace.php:5
  620. 0.0010 117584 -> ret_ord(\'e\') ../trace.php:10
  621. 0.0011 117584 -> ord(\'e\') ../trace.php:5
  622. 0.0012 117584 -> ret_ord(\'b\') ../trace.php:10
  623. 0.0013 117584 -> ord(\'b\') ../trace.php:5
  624. 0.0014 117584 -> ret_ord(\'u\') ../trace.php:10
  625. 0.0014 117584 -> ord(\'u\') ../trace.php:5
  626. 0.0016 117584 -> ret_ord(\'g\') ../trace.php:10
  627. 0.0016 117584 -> ord(\'g\') ../trace.php:5
  628. 0.0019 41152
  629. TRACE END [2007-05-06 14:37:13]
  630. </pre>
  631. </div>
  632. <div id="collect-params-4">
  633. <pre class="shell">
  634. TRACE START [2007-05-06 14:37:16]
  635. 0.0003 114112 -> {main}() ../trace.php:0
  636. 0.0004 114272 -> str_split(\'Xdebug\') ../trace.php:8
  637. 0.0007 117424 -> ret_ord($c = \'X\') ../trace.php:10
  638. 0.0007 117584 -> ord(\'X\') ../trace.php:5
  639. 0.0009 117584 -> ret_ord($c = \'d\') ../trace.php:10
  640. 0.0009 117584 -> ord(\'d\') ../trace.php:5
  641. 0.0010 117584 -> ret_ord($c = \'e\') ../trace.php:10
  642. 0.0011 117584 -> ord(\'e\') ../trace.php:5
  643. 0.0012 117584 -> ret_ord($c = \'b\') ../trace.php:10
  644. 0.0013 117584 -> ord(\'b\') ../trace.php:5
  645. 0.0014 117584 -> ret_ord($c = \'u\') ../trace.php:10
  646. 0.0014 117584 -> ord(\'u\') ../trace.php:5
  647. 0.0016 117584 -> ret_ord($c = \'g\') ../trace.php:10
  648. 0.0016 117584 -> ord(\'g\') ../trace.php:5
  649. 0.0019 41152
  650. TRACE END [2007-05-06 14:37:16]
  651. </pre>
  652. </div>
  653. </div>
  654. </div>
  655. <p>
  656. Besides the [CFG:collect_params] settings there is another number of settings
  657. that affect the output of trace files. The first tab "default" shows the same
  658. as the default as above. The second tab "show_mem_delta=1" also shows the
  659. memory usage difference between two different lines in the output file.
  660. </p>
  661. <p>
  662. On the "collect_return=1" tab the return values of all the function calls are
  663. also visible. This you turn on with the [CFG:collect_return] setting.
  664. </p>
  665. <p>
  666. The tab called "collect_assignments=1" shows variable assigments, which can be
  667. turned on with the [CFG:collect_assignments] setting.
  668. </p>
  669. <p>
  670. The last tab shows a different output format that is much easier to parse, but
  671. harder to read. The [CFG:trace_format] setting is therefore mostly useful if
  672. there is an additional tool to interpret the trace files.
  673. </p>
  674. <div id="othersettings" class="yui-navset">
  675. <ul class="yui-nav">
  676. <li class="selected"><a href="#default2"><em>default</em></a></li>
  677. <li><a href="#mem-delta"><em>show_mem_delta=1</em></a></li>
  678. <li><a href="#collect-return"><em>collect_return=1</em></a></li>
  679. <li><a href="#trace-format"><em>trace_format=1</em></a></li>
  680. </ul>
  681. <div class="yui-content">
  682. <div id="default2">
  683. <pre class="shell">
  684. TRACE START [2007-05-06 14:37:06]
  685. 0.0003 114112 -> {main}() ../trace.php:0
  686. 0.0004 114272 -> str_split() ../trace.php:8
  687. 0.0153 117424 -> ret_ord() ../trace.php:10
  688. 0.0165 117584 -> ord() ../trace.php:5
  689. 0.0166 117584 -> ret_ord() ../trace.php:10
  690. 0.0167 117584 -> ord() ../trace.php:5
  691. 0.0168 117584 -> ret_ord() ../trace.php:10
  692. 0.0168 117584 -> ord() ../trace.php:5
  693. 0.0170 117584 -> ret_ord() ../trace.php:10
  694. 0.0170 117584 -> ord() ../trace.php:5
  695. 0.0172 117584 -> ret_ord() ../trace.php:10
  696. 0.0172 117584 -> ord() ../trace.php:5
  697. 0.0173 117584 -> ret_ord() ../trace.php:10
  698. 0.0174 117584 -> ord() ../trace.php:5
  699. 0.0177 41152
  700. TRACE END [2007-05-06 14:37:07]
  701. </pre>
  702. </div>
  703. <div id="mem-delta">
  704. <pre class="shell">
  705. TRACE START [2007-05-06 14:37:26]
  706. 0.0003 114112 +114112 -> {main}() ../trace.php:0
  707. 0.0004 114272 +160 -> str_split(\'Xdebug\') ../trace.php:8
  708. 0.0007 117424 +3152 -> ret_ord($c = \'X\') ../trace.php:10
  709. 0.0007 117584 +160 -> ord(\'X\') ../trace.php:5
  710. 0.0009 117584 +0 -> ret_ord($c = \'d\') ../trace.php:10
  711. 0.0009 117584 +0 -> ord(\'d\') ../trace.php:5
  712. 0.0011 117584 +0 -> ret_ord($c = \'e\') ../trace.php:10
  713. 0.0011 117584 +0 -> ord(\'e\') ../trace.php:5
  714. 0.0013 117584 +0 -> ret_ord($c = \'b\') ../trace.php:10
  715. 0.0013 117584 +0 -> ord(\'b\') ../trace.php:5
  716. 0.0014 117584 +0 -> ret_ord($c = \'u\') ../trace.php:10
  717. 0.0015 117584 +0 -> ord(\'u\') ../trace.php:5
  718. 0.0016 117584 +0 -> ret_ord($c = \'g\') ../trace.php:10
  719. 0.0017 117584 +0 -> ord(\'g\') ../trace.php:5
  720. 0.0019 41152
  721. TRACE END [2007-05-06 14:37:26]
  722. </pre>
  723. </div>
  724. <div id="collect-return">
  725. <pre class="shell">
  726. TRACE START [2007-05-06 14:37:35]
  727. 0.0003 114112 -> {main}() ../trace.php:0
  728. 0.0004 114272 -> str_split(\'Xdebug\') ../trace.php:8
  729. >=> array (0 => \'X\', 1 => \'d\', 2 => \'e\', 3 => \'b\', 4 => \'u\', 5 => \'g\')
  730. 0.0007 117424 -> ret_ord($c = \'X\') ../trace.php:10
  731. 0.0007 117584 -> ord(\'X\') ../trace.php:5
  732. >=> 88
  733. >=> 88
  734. 0.0009 117584 -> ret_ord($c = \'d\') ../trace.php:10
  735. 0.0009 117584 -> ord(\'d\') ../trace.php:5
  736. >=> 100
  737. >=> 100
  738. 0.0011 117584 -> ret_ord($c = \'e\') ../trace.php:10
  739. 0.0011 117584 -> ord(\'e\') ../trace.php:5
  740. >=> 101
  741. >=> 101
  742. 0.0013 117584 -> ret_ord($c = \'b\') ../trace.php:10
  743. 0.0013 117584 -> ord(\'b\') ../trace.php:5
  744. >=> 98
  745. >=> 98
  746. 0.0015 117584 -> ret_ord($c = \'u\') ../trace.php:10
  747. 0.0016 117584 -> ord(\'u\') ../trace.php:5
  748. >=> 117
  749. >=> 117
  750. 0.0017 117584 -> ret_ord($c = \'g\') ../trace.php:10
  751. 0.0018 117584 -> ord(\'g\') ../trace.php:5
  752. >=> 103
  753. >=> 103
  754. >=> 1
  755. 0.0021 41152
  756. TRACE END [2007-05-06 14:37:35]
  757. </pre>
  758. </div>
  759. <div id="trace-format">
  760. <pre class="shell">
  761. Versi

Large files files are truncated, but you can click here to view the full file