<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>Derick Rethans - tag: xdebug</title>
    <link>http://derickrethans.nl/feed-xdebug.xml</link>
    <description>This feed shows the latest 15 items with the tag xdebug</description>
    <language>en-us</language>
    <copyright>All rights reserved - Derick Rethans</copyright>
    <managingEditor>derick@derickrethans.nl (Derick Rethans)</managingEditor>
    <pubDate>Sun, 18 Dec 2011 09:30:07 +0000</pubDate>
    <lastBuildDate>Sun, 18 Dec 2011 09:30:07 +0000</lastBuildDate>
    <generator>eZ Components Feed dev (http://ezcomponents.org/docs/tutorials/Feed)</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>60</ttl>
    <item>
      <title>Multiple PHP versions set-up</title>
      <link>http://derickrethans.nl/multiple-php-version-setup.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="multiple_php_versions_set-up"/&gt;Multiple PHP versions set-up&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, November 7th 2011, 09:11 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;For many of my projects (both &lt;a href="http://derickrethans.nl/projects.html"&gt;hobby&lt;/a&gt; and &lt;a href="http://derickrethans.nl/who.html#derickrethansltd"&gt;commercial&lt;/a&gt;) I need to support many different PHP configurations. Not only just different PHP versions, but also debug builds, ZTS builds and 32-bit builds. In order to be able to test and build extensions against all those different PHP configurations I have adopted a simple method that I'm sharing with you here.&lt;/p&gt;
      &lt;p&gt;The major part of it is that I use a different installation prefix for every configuration of PHP that I make. Right now, &lt;code&gt;ls /usr/local/php&lt;/code&gt; shows:&lt;/p&gt;
      &lt;pre&gt;5.1dev  5.3.2  5.3.8dev  5.3dev-32bit    5.3dev-zts  5.4dev      trunk
5.2dev  5.3.7  5.3dev    5.3dev-nodebug  5.4.0beta1  5.4dev-zts

&lt;/pre&gt;
      &lt;p&gt;There are two types of PHP installs that I make: "dev" versions from SVN branches, and "release" versions build from SVN tags. From the list above you see I have the SVN versions of 5.1, 5.2, 5.3.8, 5.3 (in various forms) and 5.4 (both normal, and ZTS).&lt;/p&gt;
      &lt;p&gt;I have a &lt;a href="http://derickrethans.nl/files/php-build.sh.txt"&gt;script&lt;/a&gt; to compile PHP which whatever combination I want: version, debug (default) or non-debug, normal (default) or ZTS; and 64-bit (default) or 32-bit. The configure options are nicely hardcoded :-)&lt;/p&gt;
      &lt;p&gt;The scripts accept arguments in a specific order:&lt;/p&gt;
      &lt;pre&gt;version ["debug"|"nodebug" [, "no-zts"|"zts" [, ""|"32bit" ] ] ]

&lt;/pre&gt;
      &lt;p&gt;For a simple 5.3dev build I run:&lt;/p&gt;
      &lt;pre&gt;./build 5.3dev

&lt;/pre&gt;
      &lt;p&gt;This compiles PHP 5.3 from SVN, in debug mode, without ZTS and for the 64-bit architecture. Something more exotic variants could be:&lt;/p&gt;
      &lt;pre&gt;./build 5.3.8 debug zts
./build 5.4dev nodebug no-zts 32bit

&lt;/pre&gt;
      &lt;p&gt;Each invocation of the script will configure and build PHP, and then install into &lt;code&gt;/usr/local/php/{{variant}}&lt;/code&gt;.&lt;/p&gt;
      &lt;p&gt;The script also has a hard coded location where the PHP sources are. In my case, that's a &lt;a href="https://wiki.php.net/vcs/svnfaq#sparse_directory_checkout_instructions"&gt;sparse checkout&lt;/a&gt; into &lt;code&gt;/home/derick/dev/php/php-src&lt;/code&gt;.&lt;/p&gt;
      &lt;p&gt;With the help of a small &lt;code&gt;.bashrc&lt;/code&gt; snippet:&lt;/p&gt;
      &lt;pre&gt;function pe () {
        version=$1
        shift

        if [ "$#" == "0" ]; then
                export PATH=/usr/local/php/${version}/bin:/usr/local/bin:/usr/bin:/bin
        else
                PATH=/usr/local/php/${version}/bin:$PATH $@
        fi
}

&lt;/pre&gt;
      &lt;p&gt;I can now easily switch between PHP versions by typing on the shell:&lt;/p&gt;
      &lt;pre&gt;pe 5.3dev

&lt;/pre&gt;
      &lt;p&gt;or:&lt;/p&gt;
      &lt;pre&gt;pe 5.4dev-zts

&lt;/pre&gt;
      &lt;p&gt;And each version will have a totally separated environment for me to install PEAR packages and PECL extensions in, and do my own extension development. Of course, each separated environment also comes with its own &lt;code&gt;php.ini&lt;/code&gt; file (in &lt;code&gt;/usr/local/php/{{variant}}/lib/php.ini&lt;/code&gt;).&lt;/p&gt;
      &lt;p&gt;This set-up makes my life a whole lot easier, and I hope it is useful for you as well. Thanks for listening!&lt;/p&gt;
      &lt;div class="flattr"&gt;
        &lt;a class="FlattrButton" rev="flattr;button:compact;" style="display: none" href="http://derickrethans.nl"/&gt;
        &lt;noscript&gt;
          &lt;a href="http://flattr.com/thing/429095/Derick-Rethans-website"&gt;
            &lt;img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this"/&gt;
          &lt;/a&gt;
        &lt;/noscript&gt;
      &lt;/div&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201111070911</guid>
      <pubDate>Mon, 07 Nov 2011 09:11:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug's Code Coverage speedup</title>
      <link>http://derickrethans.nl/xdebug-codecoverage-speedup.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_s_code_coverage_speedup"/&gt;Xdebug's Code Coverage speedup&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Friday, September 23rd 2011, 09:23 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Besides a debugging and development aid, &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; also implements the back-end code to provide code coverage information for use with &lt;a href="http://www.phpunit.de"&gt;PHPUnit&lt;/a&gt;. Code coverage tells you how much of your code base is actually being tested by your unit tests. It's a very useful feature, but sadly, it slows down PHP's execution quite a lot. One part of this slowdown is the overhead to record the information internally, but another part is because I have to overload lots of opcodes. (Opcodes are PHP's internal execution units, similar to &lt;a href="http://en.wikipedia.org/wiki/Assembler_%28computer_programming%29#Assembly_language"&gt;assembler&lt;/a&gt; instructions) They are always overloaded even if code coverage is not used, because it's only safe to overload them for the whole request.&lt;/p&gt;
      &lt;p&gt;The upcoming Xdebug 2.2 has a few changes to improve code coverage performance. First of all, the speed with which information about code coverage is recorded has been improved by &lt;a href="https://github.com/taavi/xdebug/commits/coverage_line_array"&gt;contributions&lt;/a&gt; by &lt;a href="https://github.com/taavi"&gt;Taavi Burns&lt;/a&gt;. And secondly, Xdebug 2.2 features a new setting, &lt;code&gt;xdebug.coverage_enable&lt;/code&gt; with which it is possible to disable the overloading of code coverage specific opcodes. By default that setting will still be &lt;code&gt;on&lt;/code&gt;.&lt;/p&gt;
      &lt;p&gt;Just to show how those improvements have effect on the speed, I've run a benchmark (running &lt;a href="http://incubator.apache.org/zetacomponents/"&gt;Apache Zeta Components&lt;/a&gt; Graph's tests) to compare Xdebug 2.1.2 against Xdebug 2.2-dev.&lt;/p&gt;
      &lt;p&gt;The results are as follows:&lt;/p&gt;
      &lt;table&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;td&gt;
              &lt;p&gt;Version  &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;With CC  &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;Without CC  &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;With coverage_enable=0  &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;Without Xdebug&lt;/p&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
          &lt;tr&gt;
            &lt;td&gt;
              &lt;p&gt;2.1.2    &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;06:44    &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;00:49       &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;&lt;em&gt;not available&lt;/em&gt;         &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;00:32&lt;/p&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;
              &lt;p&gt;2.2-dev  &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;05:37    &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;00:48       &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;00:46                   &lt;/p&gt;
            &lt;/td&gt;
            &lt;td&gt;
              &lt;p&gt;00:32&lt;/p&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
        &lt;/tbody&gt;
      &lt;/table&gt;
      &lt;p&gt;Another benchmark, run by &lt;a href="https://twitter.com/#!/rossmcf"&gt;Ross McFarlane&lt;/a&gt; gives: &lt;a href="https://twitter.com/#!/rossmcf/status/116086201391398913"&gt;@derickr Based on 3 runs each, execution of 254 tests with 1070 assertions has dropped from 19s to 12s. Nice work!&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;In Xdebug 2.2 I would also like to introduce &lt;em&gt;modes&lt;/em&gt;. Each mode will set a default configuration for Xdebug's setting to be the most optimal for that specific tasks. Examples of tasks could be: "profiling", "debugging" or "tracing". Let me know (in the comments) whether you think that's a good idea.&lt;/p&gt;
      &lt;div class="flattr"&gt;
        &lt;a class="FlattrButton" rev="flattr;button:compact;" style="display: none" href="http://derickrethans.nl"/&gt;
        &lt;noscript&gt;
          &lt;a href="http://flattr.com/thing/429095/Derick-Rethans-website"&gt;
            &lt;img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this"/&gt;
          &lt;/a&gt;
        &lt;/noscript&gt;
      &lt;/div&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201109230923</guid>
      <pubDate>Fri, 23 Sep 2011 08:23:00 +0000</pubDate>
    </item>
    <item>
      <title>Remote Debugging PHP with a Firewall in the Way</title>
      <link>http://derickrethans.nl/debugging-with-xdebug-and-firewalls.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="remote_debugging_php_with_a_firewall_in_the_way"/&gt;Remote Debugging PHP with a Firewall in the Way&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Thursday, August 25th 2011, 21:42 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;The PHP debugging extension &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; has "remote" &lt;a href="http://xdebug.org/docs/remote"&gt;debugging&lt;/a&gt; capabilities for single-step debugging PHP applications. This works by setting your favourite IDE into listening mode and instructing Xdebug (with one of the handy browser &lt;a href="http://xdebug.org/docs/remote#browser-extensions"&gt;extensions&lt;/a&gt; for example) to initiate debugging. When Xdebug is instructed it tries to make a connection to the IP address and port number that are &lt;a href="http://xdebug.org/docs/remote#remote_host"&gt;configured&lt;/a&gt; in php.ini. On this IP &lt;a href="http://xdebug.org/docs/remote#remote_host"&gt;address&lt;/a&gt; and &lt;a href="http://xdebug.org/docs/remote#remote_port"&gt;port&lt;/a&gt; Xdebug expects to find a listening IDE. This IP address can just be &lt;code&gt;127.0.0.1&lt;/code&gt; in case your IDE and web server/CLI script run on the same machine. But as Xdebug supports remote debugging, PHP/Xdebug could also be running on a totally different machine than your IDE. In that case, you need to pick the IP address of the machine on which the IDE is running as the configuration value for &lt;code&gt;xdebug.remote_host&lt;/code&gt;. Alternatively you can set &lt;code&gt;xdebug.remote_connect_back&lt;/code&gt; to true, so that Xdebug may simply pick up your client machine's IP address from the HTTP headers.&lt;/p&gt;
      &lt;p&gt;There could however be a firewall in the way that prevents Xdebug connecting directly to your IDE's IP address. That can be because the network you are on employs &lt;a href="http://en.wikipedia.org/wiki/Network_address_translation"&gt;NAT&lt;/a&gt; in which case you could try (to convince) to get your system administrator to install a &lt;a href="https://github.com/derickr/dbgp"&gt;DBGp&lt;/a&gt; &lt;a href="http://derickrethans.nl/debugging-with-multiple-users.html"&gt;proxy&lt;/a&gt;. In some cases, he might not be willing to do so, or perhaps, there is simply a black box that doesn't allow either a proxy to be run on it, or port forwarding to be set-up on. In this case, there is no way Xdebug can connect to your IDE's IP address and port. Or is there?&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Breaking the Firewall Down&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;There is another solution, at least, if you have &lt;a href="http://en.wikipedia.org/wiki/Secure_Shell"&gt;SSH&lt;/a&gt; access to the development machine where Xdebug is running on. In this case, you can simply ssh in and set-up a tunnel:&lt;/p&gt;
      &lt;pre&gt;ssh -R 9000:localhost:9000 username@dev.example.com

&lt;/pre&gt;
      &lt;p&gt;This command opens up port &lt;code&gt;9000&lt;/code&gt;, configured with the first &lt;code&gt;9000&lt;/code&gt; in the command, for listening on the machine where you ssh-ed into. Every connection that is made to this port is then forwarded to &lt;code&gt;localhost:9000&lt;/code&gt;, which in this case is port &lt;code&gt;9000&lt;/code&gt; on the machine from where you ran the &lt;code&gt;ssh&lt;/code&gt; command from. When you set Xdebug's &lt;code&gt;xdebug.remote_host&lt;/code&gt; setting to &lt;code&gt;localhost&lt;/code&gt; and &lt;code&gt;xdebug.remote_port&lt;/code&gt; to &lt;code&gt;9000&lt;/code&gt; you know have instructed Xdebug to connect to your SSH-tunneled connection which is forwarded to your local port &lt;code&gt;9000&lt;/code&gt;. And that is exactly where your IDE is listening for incoming debugging connections. Result: Firewall circumvented.&lt;/p&gt;
      &lt;p&gt;If you are so unfortunate to be using Windows on the client side then you don't have the luxury of being able to use the simple SSH client. However, you can set-up tunnels with &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/"&gt;putty&lt;/a&gt; as well. After configuring your normal session, go to the &lt;code&gt;Connection&lt;/code&gt;, &lt;code&gt;SSH&lt;/code&gt;, &lt;code&gt;Tunnels&lt;/code&gt; section of the configuration and fill in &lt;code&gt;Source port&lt;/code&gt; and &lt;code&gt;Destination&lt;/code&gt;, and select &lt;code&gt;Remote&lt;/code&gt;, just like in this screen shot:&lt;/p&gt;
      &lt;img src="http://derickrethans.nl/images/content/putty-tunnel-settings.png" class="center" alt="putty-tunnel-settings.png"/&gt;
      &lt;p&gt;Then click the &lt;code&gt;Add&lt;/code&gt; button and you will see the following on your screen:&lt;/p&gt;
      &lt;img src="http://derickrethans.nl/images/content/putty-tunnel-result.png" class="center" alt="putty-tunnel-result.png"/&gt;
      &lt;p&gt;Don't forget to go back to the &lt;code&gt;Session&lt;/code&gt; tab and press save. You're now ready to login and when you do so an SSH tunnel will be created just like in the Unix case above.&lt;/p&gt;
      &lt;p&gt;You can check whether it worked by running: &lt;code&gt;netstat -a -n | grep 9000&lt;/code&gt; on the SSH prompt after logging in. You should then see:&lt;/p&gt;
      &lt;pre&gt;derick@xdebug:~$ netstat -a -n | grep 9000
tcp        0      0 0.0.0.0:9000            0.0.0.0:*               LISTEN
tcp6       0      0 :::9000                 :::*                    LISTEN

&lt;/pre&gt;
      &lt;p&gt;The &lt;code&gt;tcp6&lt;/code&gt; portion might not be there, but that's all right. There, even with Windows: Firewall circumvented.&lt;/p&gt;
      &lt;div class="flattr"&gt;
        &lt;a class="FlattrButton" rev="flattr;button:compact;" style="display: none" href="http://derickrethans.nl"/&gt;
        &lt;noscript&gt;
          &lt;a href="http://flattr.com/thing/429095/Derick-Rethans-website"&gt;
            &lt;img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this"/&gt;
          &lt;/a&gt;
        &lt;/noscript&gt;
      &lt;/div&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201108252142</guid>
      <pubDate>Thu, 25 Aug 2011 20:42:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug on github</title>
      <link>http://derickrethans.nl/xdebug-git.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_on_github"/&gt;Xdebug on github&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Wednesday, June 22nd 2011, 21:47 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;I've just opened my &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; &lt;a href="https://github.com/derickr/xdebug"&gt;repository&lt;/a&gt; on &lt;a href="https://github.com"&gt;github&lt;/a&gt;. Importing my old SVN repository was a bit of a task. With the help of Ole Marius Smestad I managed to cook up a bash script to import and fix-up the repository. In the meanwhile I've learned more about git than I ever wanted to know, but still not enough. I maintain that, although git is very powerful, it is also a lot less intuitive than SVN (or even CVS).&lt;/p&gt;
      &lt;p&gt;In any case, Xdebug is now on github, as well as the Xdebug &lt;a href="https://github.com/derickr/xdebug.org"&gt;website&lt;/a&gt; (&lt;a href="http://xdebug.org"&gt;http://xdebug.org&lt;/a&gt;), my proof-of-concept debugging client &lt;a href="https://github.com/derickr/gtkdbgp"&gt;GtkDBGp&lt;/a&gt; and the specification of the protocol that Xdebug uses: &lt;a href="https://github.com/derickr/dbgp"&gt;DBGp&lt;/a&gt;. The issue tracker is still at the old location—http://bugs.xdebug.org—and I am not intending to change that.  I will keep the SVN repository active for now.&lt;/p&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201106222147</guid>
      <pubDate>Wed, 22 Jun 2011 20:47:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug 2.1.1</title>
      <link>http://derickrethans.nl/xdebug-2.1.1.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_2_1_1"/&gt;Xdebug 2.1.1&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, March 28th 2011, 09:40 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;I've just &lt;a href="http://xdebug.org/"&gt;released&lt;/a&gt; Xdebug 2.1.1. It is a bug fix release that primarily addresses issues in the debugging and profiling functionality of &lt;a href="http://xdebug.org/"&gt;Xdebug&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;Among the bug fixes is a fix that solves an &lt;a href="https://bugs.kde.org/show_bug.cgi?id=256425#c10"&gt;issue&lt;/a&gt; with newer versions of the &lt;a href="http://kcachegrind.sourceforge.net/html/Home.html"&gt;KCacheGrind&lt;/a&gt; profiling GUI. The newer versions are more strict with input which causes an issue with Xdebug &lt;a href="http://xdebug.org/docs/profiler"&gt;profiler&lt;/a&gt;'s files. Xdebug 2.1.1 solves &lt;a href="http://bugs.xdebug.org/bug_view_page.php?bug_id=00000639"&gt;this&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;As an &lt;a href="http://drck.me/sponsor-xdebug-8ky"&gt;experiment&lt;/a&gt; I set up a pledge system to allow myself to work on this (and related issues) during my "work time".  Twenty-four pledges were made, in about two weeks; matching the goal. Sebastian, Jan, Michael, &lt;a href="http://www.palepurple.co.uk/"&gt;Pale Purple&lt;/a&gt;, Jeff, Christoph, Karel, Yannick, Jake, Venakis, Brian, Simon, Kenneth, DM Baker, "gizmola", Ladislav, Volker, &lt;a href="http://www.react.nl/"&gt;React&lt;/a&gt;, Michal and three anonymous supporters—thanks for your support!&lt;/p&gt;
      &lt;p&gt;&lt;a href="http://bugs.xdebug.org/bug_view_page.php?bug_id=00000642"&gt;Another&lt;/a&gt; main issue that was fixed was that line numbers (in function traces, profile files and while debugging) for "magic" function calls (such as __get(), __call() etc) were always recorded as 0. This made it impossible to set breakpoints for example.&lt;/p&gt;
      &lt;p&gt;You can find Xdebug 2.1.1's source and Windows binaries at the &lt;a href="http://xdebug.org/download.php#releases"&gt;download&lt;/a&gt; page. A full &lt;a href="http://xdebug.org/updates.php#x_2_1_1"&gt;ChangeLog&lt;/a&gt; is available as well.  Through &lt;a href="https://twitter.com/xdebug"&gt;twitter&lt;/a&gt; you can kept up-to-date about Xdebug's development efforts and support is available through the &lt;a href="http://xdebug.org/support.php#list"&gt;mailinglist&lt;/a&gt;. If you think that Xdebug is a valuable tool, you can &lt;a href="http://xdebug.org/donate.php"&gt;donate&lt;/a&gt; via PayPal.&lt;/p&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201103280940</guid>
      <pubDate>Mon, 28 Mar 2011 08:40:00 +0000</pubDate>
    </item>
    <item>
      <title>Sponsoring Xdebug</title>
      <link>http://derickrethans.nl/sponsoring-xdebug.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="sponsoring_xdebug"/&gt;Sponsoring Xdebug&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Tuesday, March 22nd 2011, 18:30 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Over the past 7 years I've spend countless hours making &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; an awesome development and debugging tool. I love working on it; it is a good way to get familiar with PHP's "interesting" internals, and it also helps PHP developers finding (potential) issues within their code base faster.&lt;/p&gt;
      &lt;p&gt;With the 2.0 release announcement I &lt;a href="http://derickrethans.nl/xdebug-2-released.html"&gt;asked&lt;/a&gt; users of Xdebug to send me a postcard if they liked it; and since the 2.1 announcement I &lt;a href="http://drck.me/xdebug-2.1-7x2"&gt;mention&lt;/a&gt; that it is possible to give &lt;a href="http://xdebug.org/donate.php"&gt;donations&lt;/a&gt; through PayPal. I have received quite few postcards and donations.&lt;/p&gt;
      &lt;p&gt;Recently, an &lt;a href="https://bugs.kde.org/show_bug.cgi?id=256425#c10"&gt;issue&lt;/a&gt; with &lt;a href="http://kcachegrind.sourceforge.net/html/Home.html"&gt;KCacheGrind&lt;/a&gt; and Xdebug's &lt;a href="http://xdebug.org/docs/profiler"&gt;profiler&lt;/a&gt; functionality became known. As an &lt;a href="http://sebastian-bergmann.de/archives/909-On-Sponsored-Open-Source-Development.html"&gt;experiment&lt;/a&gt; Sebastian suggested to see whether it would be a good idea to set-up a pledge-like system to arrange some funding so that I can dedicate my "work time" to working on Xdebug issues and features.  I set-up a &lt;a href="http://pledgie.com/campaigns/14641"&gt;campaign&lt;/a&gt; on &lt;a href="http://pledgie.com"&gt;Pledgie&lt;/a&gt; for this purpose. Both Sebastian and I expected Pledgie to work a bit different than it actually did. Instead of holding on to the pledged money until the issue was implemented, it transfered the pledges directly to my PayPal account.&lt;/p&gt;
      &lt;p&gt;Twenty-four pledges were made, in about two weeks; matching the goal. Thanks Sebastian, Jan, Michael, &lt;a href="http://www.palepurple.co.uk/"&gt;Pale Purple&lt;/a&gt;, Jeff, Christoph, Karel, Yannick, Jake, Venakis, Brian, Simon, Kenneth, DM Baker, "gizmola", Ladislav, Volker, &lt;a href="http://www.react.nl/"&gt;React&lt;/a&gt;, Michal and three anonymous supporters!&lt;/p&gt;
      &lt;p&gt;Last night I &lt;a href="http://xdebug.org/archives/xdebug-dev/1740.html"&gt;committed&lt;/a&gt; several patches to the Xdebug &lt;a href="http://svn.xdebug.org/cgi-bin/viewvc.cgi/xdebug/?root=xdebug"&gt;repository&lt;/a&gt;, including the one that sparked the idea to set-up a pledge to fund Xdebug's profiler files. These patches, and a few others, now form part of the upcoming Xdebug 2.1.1 release. I've published the &lt;a href="http://xdebug.org/download.php#releases"&gt;source&lt;/a&gt; package for the first (and most likely only) release candidate: &lt;a href="http://xdebug.org/updates.php#x_2_1_0rc1"&gt;Xdebug 2.1.1RC1&lt;/a&gt;. Windows binaries will follow shortly. You can also install/upgrade the release candidate through PECL: &lt;code&gt;pecl install xdebug-beta&lt;/code&gt; or &lt;code&gt;pecl upgrade xdebug-beta&lt;/code&gt;.&lt;/p&gt;
      &lt;p&gt;The Pledgie campaign has now been closed, but I am intending to set-up new ones for more of the elaborate features—most likely starting with one related to Xdebug's &lt;a href="http://xdebug.org/docs/code_coverage"&gt;code coverage&lt;/a&gt; functionality. In the meanwhile, please test &lt;a href="http://xdebug.org/updates.php#x_2_1_0rc1"&gt;Xdebug 2.1.1RC1&lt;/a&gt;, and let me know your comments about sponsoring specific Xdebug features. I plan on releasing to write up some more thoughts about that soon. I expect Xdebug 2.1.1 to come out before the end of the month. If you think Xdebug is useful, feel free to &lt;a href="http://xdebug.org/donate.php"&gt;donate&lt;/a&gt; as well!&lt;/p&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201103221830</guid>
      <pubDate>Tue, 22 Mar 2011 18:30:00 +0000</pubDate>
    </item>
    <item>
      <title>Debugging Variables</title>
      <link>http://derickrethans.nl/debugging-variables.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="debugging_variables"/&gt;Debugging Variables&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Thursday, February 10th 2011, 09:12 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Sometimes you want to inspect the contents of variables more closely, by looking at its internal properties. For this, PHP has the  &lt;a href="http://php.net/debug_zval_dump"&gt;debug_zval_dump&lt;/a&gt; function.&lt;/p&gt;
      &lt;p&gt;The internal representation of a PHP variable container (called zval), contains the type and value of a variable, but also whether it is a reference and what its refcount is. Due to PHP's copy-on-write policy, one specific zval container can be used by multiple variables at the same time as we will see in a bit.&lt;/p&gt;
      &lt;p&gt;The &lt;code&gt;refcount&lt;/code&gt; field contains how many symbols (variable names) point to a zval, regardless of whether a reference set is used or not. For example, both the following examples will have as end-result: two symbols and one zval:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$a = 42; // one symbol: 'a'; one zval: int(42)
$b = $a; // two symbols: 'a', 'b'; one zval: int(42)
?&gt;

&lt;?php
$a = 42; // one symbol: 'a'; one zval: int(42)
$b =&amp; $a; // two symbols: 'a', 'b'; one zval: int(42)
?&gt;

&lt;/pre&gt;
      &lt;p&gt;In order for PHP to know the difference, there is an extra flag on the zval: &lt;code&gt;is_ref&lt;/code&gt;, which is set if you assign a variable by reference with &lt;code&gt;=&amp;&lt;/code&gt;. It is important to know which of the situations actually occurred because PHP needs to be able to do the correct thing when a third symbol comes into play. In the first situation, a third symbol can be associated with the same zval &lt;strong&gt;only&lt;/strong&gt; if it is assigned by assignment. If the third symbol is assigned by reference with something like &lt;code&gt;$c =&amp; $b&lt;/code&gt;; then PHP needs to duplicate (split) the zval into two zvals because only symbol &lt;code&gt;b&lt;/code&gt; and &lt;code&gt;c&lt;/code&gt; are linked, whereas &lt;code&gt;a&lt;/code&gt; is distinct. Without the separation PHP will not be able to know which of the two symbols are referenced (&lt;code&gt;b&lt;/code&gt; and &lt;code&gt;c&lt;/code&gt;), and which one is not part of the reference set (&lt;code&gt;a&lt;/code&gt;).&lt;/p&gt;
      &lt;p&gt;The opposite happens in the second situation. If a third symbol is assigned by reference with something like &lt;code&gt;$c =&amp; $b&lt;/code&gt;; then PHP can just update the &lt;code&gt;refcount&lt;/code&gt; on the zval. If the third symbol is assigned by value with &lt;code&gt;$c =
$b&lt;/code&gt; then PHP needs to split the zval so that &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; still point to the original zval, and &lt;code&gt;c&lt;/code&gt; to the newly created one without having links to either &lt;code&gt;a&lt;/code&gt; or &lt;code&gt;b&lt;/code&gt;.&lt;/p&gt;
      &lt;p&gt;This brings us to the very simple rule for when PHP needs to split upon assignment:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;If the type of assigning (by-value with &lt;code&gt;=&lt;/code&gt; or by-ref with &lt;code&gt;=&amp;&lt;/code&gt;) matches the value of &lt;code&gt;is_ref&lt;/code&gt;: just update &lt;code&gt;refcount&lt;/code&gt; by adding 1.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;If the type of assigning does not match the value of &lt;code&gt;is_ref&lt;/code&gt;: split the zval.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;Now let us get back to the original issue: the inspection of the internal structure of variable contents with  &lt;a href="http://php.net/debug_zval_dump"&gt;debug_zval_dump&lt;/a&gt;. When a variable is passed to a function as an argument, an assignment to the function's local scope is made; just like an assignment in a function. Which means that the same splitting rules apply. The following are (mostly) equivalent regarding on what happens to the &lt;code&gt;is_ref&lt;/code&gt; and &lt;code&gt;refcount&lt;/code&gt; values:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$a = 42;
$b = $a; // assignment in local scope
?&gt;

&lt;/pre&gt;
      &lt;p&gt;and:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
function foo($b)
{
}

$a = 42;
foo($a); // assignment to $b in the function's scope
?&gt;

&lt;/pre&gt;
      &lt;p&gt;PHP's  &lt;a href="http://php.net/debug_zval_dump"&gt;debug_zval_dump&lt;/a&gt; takes a variable as argument for analysis and is thus also bound to the same splitting rules as outlined earlier. This means that's not really well suited for dumping a zval's internal structure as it would always modify the zval. Besides adding 1 to the &lt;code&gt;refcount&lt;/code&gt; field, it could also force a split resulting in unexpected output:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$a = 42;
debug_zval_dump($a);
?&gt;

&lt;/pre&gt;
      &lt;p&gt;shows:&lt;/p&gt;
      &lt;pre&gt;long(42) refcount(2)

&lt;/pre&gt;
      &lt;p&gt;&lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; has a similar function to display a zval's internal data: &lt;a href="http://xdebug.org/docs/all_functions#xdebug_debug_zval"&gt;xdebug_debug_zval&lt;/a&gt;. This function does requires not a variable to be passed as its argument, but instead requires a variable &lt;strong&gt;name&lt;/strong&gt; to be passed in. With this, the manipulation of the zval is avoided and the proper values are shown:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$a = 42;
xdebug_debug_zval('a');
?&gt;

&lt;/pre&gt;
      &lt;p&gt;which shows:&lt;/p&gt;
      &lt;pre&gt;a: (refcount=1, is_ref=0)=42

&lt;/pre&gt;
      &lt;p&gt;This is what is expected, and as bonus, it also shows the &lt;code&gt;is_ref&lt;/code&gt; flag. PHP's &lt;a href="http://bugs.php.net/bug.php?id=53895"&gt;bug #53895&lt;/a&gt; mentions a few issues with the  &lt;a href="http://php.net/debug_zval_dump"&gt;debug_zval_dump&lt;/a&gt; function. Gustavo is quite right to say that passing the variable name by-ref is not going to work, and any form of this function where the variable is passed in is not going to work. Johannes however is also right that passing just the variable name as a string might not be good enough; as you can't directly dump the zval information for for example array keys. There is an Xdebug &lt;a href="http://bugs.xdebug.org/view.php?id=310"&gt;feature request&lt;/a&gt; for this functionality to be implemented however. If implemented, you should be able to debug the &lt;code&gt;foo&lt;/code&gt; array key with something like:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$a = array('foo' =&gt; 3.1415);
xdebug_debug_zval('a["foo"]');
?&gt;

&lt;/pre&gt;
      &lt;p&gt;Now if I only had some spare time...&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201102100912</guid>
      <pubDate>Thu, 10 Feb 2011 09:12:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug 2.1</title>
      <link>http://derickrethans.nl/xdebug-2.1-released.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_2_1"/&gt;Xdebug 2.1&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Tuesday, June 29th 2010, 15:17 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;img src="http://derickrethans.nl/images/content/xdebug_logo.png" class="right" alt="xdebug_logo.png"/&gt;
      &lt;p&gt;I've just released &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; 2.1. This new release contains all the bug fixes and new features that have been developed over the past three years. It provides full PHP 5.3 support, but it no longer supports PHP versions below 5.1.&lt;/p&gt;
      &lt;p&gt;A description of all the new features follows:&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Error Collection&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;I've added xdebug_start_error_collection(), xdebug_stop_error_collection() and xdebug_get_collected_errors(), which allow you to collect all notices, warnings and error messages that Xdebug generates from PHP's error_reporting functionality so that you can output them at a later point in your script by hand.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Header Setting Interception&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;All functions that set HTTP headers such as with &lt;a href="http://php.net/header"&gt;header()&lt;/a&gt; and &lt;a href="http://php.net/setcookie"&gt;setcookie()&lt;/a&gt; are now intercepted by Xdebug. The intercepted headers are stored internally in an array that can be retrieved by calling the &lt;a href="http://xdebug.org/docs/all_functions#xdebug_get_headers"&gt;xdebug_get_headers()&lt;/a&gt; function. This is very useful in cases where you need to test certain functionality that sets headers somewhere deep in code. This function is also used in &lt;a href="http://ezcomponents.org"&gt;eZ Components'&lt;/a&gt; test suite to &lt;a href="http://svn.ez.no/svn/ezcomponents/trunk/MvcTools/tests/response_writers/http.php"&gt;test&lt;/a&gt; whether the correct HTTP headers are set in the &lt;a href="http://ezcomponents.org/s/MvcTools"&gt;MvcTools&lt;/a&gt; component.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Variable Assignment Tracing&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;The new setting &lt;a href="http://xdebug.org/docs/all_settings#collect_assignments"&gt;xdebug.collect_assignments&lt;/a&gt; allows you to record changes to variables in scripts to &lt;a href="http://xdebug.org/docs/execution_trace"&gt;trace files&lt;/a&gt;.  I've already written more about it in &lt;a href="http://derickrethans.nl/variable-tracing-with-xdebug.html"&gt;Variable tracing with Xdebug&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;"Scream" Support&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;The &lt;a href="http://pecl.php.net/scream"&gt;scream&lt;/a&gt; PECL extension disables the &lt;code&gt;@&lt;/code&gt; (shut-up) operator to actually see all notices, warnings and errors that PHP generates. The scream extension's functionality have been duplicated as Xdebug's &lt;a href="http://xdebug.org/docs/all_settings#scream"&gt;xdebug.scream&lt;/a&gt; php.ini setting. Why disabling the @-operator is a good thing, I've already outlined in &lt;a href="http://derickrethans.nl/five-reasons-why-the-shutop-operator-should-be-avoided.html"&gt;Five reasons why the shut-op operator (@) should be avoided&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Additions for Stack Traces&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;All HTML containers generated by Xdebug (error messages, &lt;a href="http://xdebug.org/docs/all_functions#xdebug_var_dump"&gt;xdebug_var_dump()&lt;/a&gt; output) now contain a CSS class for easier styling.&lt;/p&gt;
      &lt;p&gt;The new setting &lt;a href="http://xdebug.org/docs/all_settings#file_link_format"&gt;xdebug.file_link_format&lt;/a&gt; allows you to turn any file/line link in Xdebug's output to be decorated to a link with a specific format.  For example you can set it to &lt;code&gt;txmt://open/?file://%f&amp;line=%l&lt;/code&gt; for opening files directly in Textmate, or &lt;code&gt;gvim://%f@%l&lt;/code&gt; with some shell script for gvim and Firefox.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Remote Debugging&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;The new setting &lt;a href="http://xdebug.org/docs/all_settings#remote_connect_back"&gt;xdebug.remote_connect_back&lt;/a&gt;, contributed by Lucas Nealan and Brian Shire, allows Xdebug to try to make a debugging connection to the IP address from which the browser request came from. This setting is an additional solution for &lt;a href="http://derickrethans.nl/debugging-with-multiple-users.html"&gt;debugging with multiple users&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;The old &lt;code&gt;gdb&lt;/code&gt; and &lt;code&gt;php3&lt;/code&gt; remote debugging engines have been removed.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Overloaded var_dump&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;The newly introduced setting xdebug.overload_var_dump can be used to turn off Xdebug's default behavior of overriding PHP's &lt;a href="http://php.net/var_dump"&gt;var_dump()&lt;/a&gt; function with the &lt;a href="http://xdebug.org/docs/all_functions#xdebug_var_dump"&gt;xdebug_var_dump()&lt;/a&gt; function that uses pretty HTML for formatting a variable structure. It does not stop &lt;a href="http://xdebug.org/docs/all_functions#xdebug_var_dump"&gt;xdebug_var_dump()&lt;/a&gt; from working however.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Donations&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;You can probably imagine that writing and support Xdebug is a time-consuming effort. It's a tool that saves a lot of work during developement of applications, as well while debugging.  If you think Xdebug is valuable for you, perhaps you would like to consider a &lt;a href="http://xdebug.org/donate.php"&gt;donation&lt;/a&gt;. All donations are greatly appreciated and support future development and availablity of Xdebug.&lt;/p&gt;
      &lt;p&gt;If you want to sponsor a (new) feature in Xdebug, feel free to &lt;a href="mailto:derick@xdebug.org"&gt;contact&lt;/a&gt; me as well.&lt;/p&gt;
      &lt;p&gt;
        &lt;strong&gt;Download and Support&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;The new version of Xdebug can be downloaded through the &lt;a href="http://xdebug.org/download.php"&gt;download&lt;/a&gt; page. A list with all changes can be found on the &lt;a href="http://xdebug.org/updates.php#x_2_1_0"&gt;updates&lt;/a&gt; page. Support information can be found on the &lt;a href="http://xdebug.org/support.php"&gt;support&lt;/a&gt; page, and issues and feature requests can be filed in the &lt;a href="http://bugs.xdebug.org"&gt;bug tracker&lt;/a&gt;. Before asking for support, please have a look at the &lt;a href="http://xdebug.org/docs/faq"&gt;FAQ&lt;/a&gt; first.&lt;/p&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201006291449</guid>
      <pubDate>Tue, 29 Jun 2010 14:17:00 +0000</pubDate>
    </item>
    <item>
      <title>Find my Xdebug download wizard</title>
      <link>http://derickrethans.nl/find-my-xdebug-download-wizard.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="find_my_xdebug_download_wizard"/&gt;Find my Xdebug download wizard&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, May 3rd 2010, 10:00 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Installing &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; seems to be a problem for some users. The main trouble is for Windows users that don't know which file to download. Over the past few days I've worked on a &lt;a href="http://xdebug.org/find-binary.php"&gt;wizard&lt;/a&gt; that analyses &lt;a href="http://php.net/phpinfo"&gt;phpinfo()'s&lt;/a&gt; output and for Windows users suggests:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;which file to download&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;where to put the file&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;which php.ini file to modify, and how&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;For Unix users, it explains:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;which source tarball to download&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;how to compile&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;which php.ini file to modify, and how&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;I hope this makes it a bit easier to get going with Xdebug. Next up (hopefully this week) is release candidate 2 for Xdebug 2.1.0.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201005031000</guid>
      <pubDate>Mon, 03 May 2010 09:00:00 +0000</pubDate>
    </item>
    <item>
      <title>VLD released</title>
      <link>http://derickrethans.nl/vld-released.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="vld_released"/&gt;VLD released&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, April 12th 2010, 21:57 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;I just released a new version of &lt;a href="http://derickrethans.nl/projects.html#vld"&gt;VLD&lt;/a&gt; through &lt;a href="http://pecl.php.net/package/vld"&gt;PECL&lt;/a&gt;. This release features the path analytics code that I've outlined in an &lt;a href="http://derickrethans.nl/more-source-analysis-with-vld.html"&gt;earlier article&lt;/a&gt;. There are also a few fixes for PHP's current trunk, as well as the possibility to format output slightly like a CSV file. That feature was used to make &lt;a href="http://www.zapt.info/opcodes.html"&gt;this&lt;/a&gt; documentation of opcodes.&lt;/p&gt;
      &lt;p&gt;The path analysis algorithm that &lt;a href="http://derickrethans.nl/projects.html#vld"&gt;VLD&lt;/a&gt; now has, can possibly also be used to get path/branch coverage working within &lt;a href="http://xdebug.org"&gt;Xdebug's&lt;/a&gt; code-coverage framework. This is however not a minor task.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201004122157</guid>
      <pubDate>Mon, 12 Apr 2010 20:57:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug 2.1.0 RC1 released</title>
      <link>http://derickrethans.nl/xdebug-2.1.0rc1-released.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_2_1_0_rc1_released"/&gt;Xdebug 2.1.0 RC1 released&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Schiphol, Netherlands&lt;/div&gt;
        &lt;div class="date"&gt;Tuesday, April 6th 2010, 15:41 CEST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;As earlier announced in my April Fools' &lt;a href="http://derickrethans.nl/xdebug-will-cost-money.html"&gt;announcement&lt;/a&gt; and on Xdebug's &lt;a href="http://twitter.com/xdebug/status/11687180290"&gt;twitter&lt;/a&gt; feed, I'm now releasing &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; 2.1.0RC1. This is the first Release Candidate and it addresses a number of &lt;a href="http://xdebug.org/updates.php#x_2_1_0rc1"&gt;issues&lt;/a&gt; found in the latest beta. As I usually do in release announcements, I will also be introducing a new feature in Xdebug 2.1 in this one.&lt;/p&gt;
      &lt;p&gt;In an &lt;a href="http://derickrethans.nl/five-reasons-why-the-shutop-operator-should-be-avoided.html"&gt;article&lt;/a&gt; that I wrote a few months ago, I illustrated a few different reasons on why the shut-op operator (&lt;code&gt;@&lt;/code&gt;) should be avoided. Although there are a few cases where it simple can not be avoided if you want to write notice-free code, the main reason why this operator should be avoided, is because it makes debugging quite a bit more difficult if errors are hidden.&lt;/p&gt;
      &lt;p&gt;Xdebug is a debugging aid to make debugging easier. So from version 2.1.0 there is a new configuration setting — &lt;code&gt;xdebug.scream&lt;/code&gt; — that simply disables the effects of the &lt;code&gt;@&lt;/code&gt; operator. That means that all errors will be shown, of course, still listening to the &lt;code&gt;error_reporting&lt;/code&gt; and &lt;code&gt;display_errors&lt;/code&gt; settings. This functionality is not a novel thing, and the idea was lifted from the PECL &lt;a href="http://pecl.php.net/scream"&gt;scream&lt;/a&gt; package. However, I think this functionality fits in very well with all the other things that Xdebug has to offer.&lt;/p&gt;
      &lt;p&gt;Just to mention it once more, I have no intention of making Xdebug closed source. I spend a considerable amount of time in adding new features and addressing issues, so I would appreciate it that if consider a &lt;a href="http://xdebug.org/donate.php"&gt;donation&lt;/a&gt; in case Xdebug has saved you time and effort in debugging your application. If you have comments or suggestions to improve Xdebug, please write to the &lt;a href="http://xdebug.org/support.php#list"&gt;mailinglist&lt;/a&gt;.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201004061541</guid>
      <pubDate>Tue, 06 Apr 2010 13:41:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug no longer Open Source</title>
      <link>http://derickrethans.nl/xdebug-will-cost-money.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_no_longer_open_source"/&gt;Xdebug no longer Open Source&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Thursday, April 1st 2010, 10:19 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;
        &lt;strong&gt;This was obviously an April Fools' joke, Xdebug will continue to stay Open Source and free of charge.&lt;/strong&gt;
      &lt;/p&gt;
      &lt;p&gt;Later today I will be releasing the first Release Candidate of Xdebug 2.1. With regret I have to announce that from this release, I will no longer provide Xdebug as an open source debugger extension. I've noticed that there are other projects making money of Xdebug's success while I only receive &lt;a href="http://xdebug.org/donate.php"&gt;donations&lt;/a&gt; from a group of awesome supporters.&lt;/p&gt;
      &lt;p&gt;Xdebug will continue to be available for benefactors on a limited number of platforms that I have access to (Linux 32/64bit and Windows). Please refer to the &lt;a href="http://derickrethans.nl/files/dump/faq.html"&gt;FAQ&lt;/a&gt; for further information.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201004011019</guid>
      <pubDate>Thu, 01 Apr 2010 09:19:00 +0000</pubDate>
    </item>
    <item>
      <title>Available for PHP Extension Writing</title>
      <link>http://derickrethans.nl/available-for-php-extension-writing.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="available_for_php_extension_writing"/&gt;Available for PHP Extension Writing&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, March 15th 2010, 12:28 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Slightly more than a month ago I left my job as team-lead of &lt;a href="http://ezcomponents.org"&gt;eZ Components&lt;/a&gt; at &lt;a href="http://ez.no"&gt;eZ Systems&lt;/a&gt; behind, to focus on something new. During the past month I've been contemplating about what to do next and realized that I do not want to take on a new full-time position right away.  Instead I will be available to work on (custom) PHP extensions and internals related issues. Extensions are a great way around PHP's limitations and performance issues.&lt;/p&gt;
      &lt;p&gt;As first project I am working on a "&lt;a href="https://github.com/derickr/quickhash"&gt;QuickHash&lt;/a&gt;" extension for &lt;a href="http://www.stumbleupon.com/"&gt;StumbleUpon&lt;/a&gt;. This extension circumvents PHP's hefty memory (and performance) overhead by providing more specific data structures. The extension currently implements integer sets and integer to integer hashes. I am now adding integer to string hashes and string to integer hashes. The QuickHash extension will be released under the PHP Licence and I will dedicate another post to it later.&lt;/p&gt;
      &lt;p&gt;If, like &lt;a href="http://www.stumbleupon.com/"&gt;StumbleUpon&lt;/a&gt;, you are also interested in having work done on PHP or a specific extensions feel free to &lt;a href="http://derickrethans.nl/who.html"&gt;contact&lt;/a&gt; me. I'd be happy to discuss things with you.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201003151228</guid>
      <pubDate>Mon, 15 Mar 2010 12:28:00 +0000</pubDate>
    </item>
    <item>
      <title>Xdebug 2.1.0beta3 released</title>
      <link>http://derickrethans.nl/xdebug-210beta3.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="xdebug_2_1_0beta3_released"/&gt;Xdebug 2.1.0beta3 released&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Saturday, February 27th 2010, 23:57 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;I've just released Xdebug 2.1.0beta3 which includes a few crash bugs as well as the issue that headers sent from PHP scripts are not actually set.&lt;/p&gt;
      &lt;p&gt;You can find the full changelog &lt;a href="http://xdebug.org/updates.php#x_2_1_0beta3"&gt;here&lt;/a&gt; and get the latest version from the &lt;a href="http://xdebug.org/download.php"&gt;download page&lt;/a&gt;.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201002272352</guid>
      <pubDate>Sat, 27 Feb 2010 23:57:00 +0000</pubDate>
    </item>
    <item>
      <title>More source analysis with VLD</title>
      <link>http://derickrethans.nl/more-source-analysis-with-vld.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="more_source_analysis_with_vld"/&gt;More source analysis with VLD&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Friday, February 19th 2010, 11:27 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;&lt;a href="http://derickrethans.nl/projects.html#vld"&gt;VLD&lt;/a&gt; is a tool that I started working on years ago to visualise the opcode arrays in PHP. Opcode arrays are what PHP's compiler generates from your source code and can be compared to assembler code that is generated by a C compiler. Instead of it being directly executed by the CPU, it is instead executed by PHP's interpreter.&lt;/p&gt;
      &lt;p&gt;Over the years I've been adding some functionality, also aided by &lt;a href="http://ilia.ws"&gt;Ilia&lt;/a&gt; and some others, to show more information. For example Ilia has added a more verbose dumping format for opcodes (through the &lt;code&gt;vld.verbosity&lt;/code&gt; setting) whereas I have added routines to find out which ops in oparrays can never be reached. A very simple example of the latter is shown here:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
function test()
{
        echo "Hello!\n";
        return true;

        echo "This will not be executed.\n";
}
?&gt;

&lt;/pre&gt;
      &lt;p&gt;If we run the above through VLD with &lt;code&gt;php -dvld.active=1 test.php&lt;/code&gt;, you'll see the following output (I removed the part about the script body itself):&lt;/p&gt;
      &lt;pre&gt;Function test:
filename:       /tmp/test1.php
function name:  test
number of ops:  9
compiled vars:  none
line     # *  op           fetch  ext  return  operands
---------------------------------------------------------
   2     0  &gt;   EXT_NOP
   4     1      EXT_STMT
         2      ECHO                           'Hello%21%0A'
   5     3      EXT_STMT
         4    &gt; RETURN                         true
   7     5*     EXT_STMT
         6*     ECHO                           'This+will+not+be+executed.%0A'
   8     7*     EXT_STMT
         8*   &gt; RETURN                         null

End of function test.

&lt;/pre&gt;
      &lt;p&gt;Every opcode that has a &lt;code&gt;*&lt;/code&gt; after the number (like in &lt;code&gt;5*&lt;/code&gt;) is code that can not be reached, and can possibly be eliminated from the oparrays in an optimiser.&lt;/p&gt;
      &lt;p&gt;The dead code analysis routines have also made their way into &lt;a href="http://xdebug.org"&gt;Xdebug&lt;/a&gt; which uses them for the &lt;a href="http://xdebug.org/docs/code_coverage"&gt;code coverage&lt;/a&gt; functionality to highlight dead code. This mostly makes sense if you are running your code coverage together with unit tests such as you can do with &lt;a href="http://www.phpunit.de"&gt;PHPUnit&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;Recently I've been working on some new functionality to visualise all the code &lt;em&gt;paths&lt;/em&gt; that make up each function. These new routines sit on top of the routines that do dead code analysis. Every branch instruction (such as &lt;code&gt;if&lt;/code&gt;, but also &lt;code&gt;for&lt;/code&gt; and &lt;code&gt;foreach&lt;/code&gt;) is analysed and a list of branches is created. Each branch contains information about the line on which the branch starts, the starting and ending opcode numbers that belong to the branch, as well as to which other branches this branch can jump to. There can be either no linked branches (when for example a &lt;code&gt;return&lt;/code&gt; or &lt;code&gt;throw&lt;/code&gt; statement is found), one linked branch (for an unconditional jump) or two linked branches (on a branch instruction).  However, you need to be aware that internally, PHP's opcode don't always reflect the &lt;em&gt;source code&lt;/em&gt; exactly.&lt;/p&gt;
      &lt;p&gt;Once all the branches and their links are found, another algorithm runs to figure out which paths can be created out of all the branches. It is best to illustrate this with an example. So let us look at the following script:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
function test()
{
        for( $i = 0; $i &lt; 10; $i++ )
        {
                if ( $i &lt; 5 )
                {
                        echo "-";
                }
                else
                {
                        echo "+";
                }
        }
        echo "\n";
}
?&gt;

&lt;/pre&gt;
      &lt;p&gt;In this script we have a &lt;code&gt;for&lt;/code&gt;-loop with a nested &lt;code&gt;if&lt;/code&gt; construct. When we run this script through VLD (with &lt;code&gt;php -dvld.verbosity=0 -dvld.dump_paths=1
-dvld.active=1 test2.php&lt;/code&gt;) we get the following output (again, only the &lt;code&gt;test()&lt;/code&gt; function and with some white space modifications):&lt;/p&gt;
      &lt;pre&gt;Function test:
filename:       /tmp/test2.php
function name:  test
number of ops:  22
compiled vars:  !0 = $i
line     # *  op             fetch  ext  return  operands
-----------------------------------------------------------
   2     0  &gt;   EXT_NOP
   4     1      EXT_STMT
         2      ASSIGN                             !0, 0
         3  &gt;   IS_SMALLER                 ~1      !0, 10
         4      EXT_STMT
         5    &gt; JMPZNZ                  9          ~1, -&gt;18
         6  &gt;   POST_INC                   ~2      !0
         7      FREE                               ~2
         8    &gt; JMP                                -&gt;3
   6     9  &gt;   EXT_STMT
        10      IS_SMALLER                 ~3      !0, 5
   7    11    &gt; JMPZ                               ~3, -&gt;15
   8    12  &gt;   EXT_STMT
        13      ECHO                               '-'
   9    14    &gt; JMP                                -&gt;17
  12    15  &gt;   EXT_STMT
        16      ECHO                               '%2B'
  14    17  &gt; &gt; JMP                                -&gt;6
  15    18  &gt;   EXT_STMT
        19      ECHO                               '%0A'
  16    20      EXT_STMT
        21    &gt; RETURN                             null

branch: #  0; line:  2- 4; sop:  0; eop:  2; out1:   3
branch: #  3; line:  4- 4; sop:  3; eop:  5; out1:  18; out2:   9
branch: #  6; line:  4- 4; sop:  6; eop:  8; out1:   3
branch: #  9; line:  6- 7; sop:  9; eop: 11; out1:  12; out2:  15
branch: # 12; line:  8- 9; sop: 12; eop: 14; out1:  17
branch: # 15; line: 12-14; sop: 15; eop: 16; out1:  17
branch: # 17; line: 14-14; sop: 17; eop: 17; out1:   6
branch: # 18; line: 15-16; sop: 18; eop: 21
path #1: 0, 3, 18,
path #2: 0, 3, 9, 12, 17, 6, 3, 18,
path #3: 0, 3, 9, 15, 17, 6, 3, 18,
End of function test.

&lt;/pre&gt;
      &lt;p&gt;This dump consists of a few different parts. First of all we can see some basic information containing the name, the number of ops (22) and the compiled variables. The second part is a dump of all the opcodes that make up this function. The last part contains information about all the branches and the possible paths.  This information is a bit hard to visualize in its textual form, so I've also added some code that dumps this information to a file format that the &lt;a href="http://graphviz.org/"&gt;GraphViz&lt;/a&gt; tool "dot" can use to create a pretty graph. For this we re-run the previous PHP invocation as &lt;code&gt;php -dvld.dump_paths=1
-dvld.verbosity=0 -dvld.save_paths=1 -dvld.active=1 test2.php&lt;/code&gt;. This creates the file &lt;code&gt;/tmp/paths.dot&lt;/code&gt; that "dot" can use. If we run &lt;code&gt;dot -Tpng
/tmp/paths.dot &gt; /tmp/paths.png&lt;/code&gt; we end up with the following picture:&lt;/p&gt;
      &lt;img src="http://derickrethans.nl/images/vld-paths.png" alt="vld-paths.png"/&gt;
      &lt;p&gt;If we put this graph next to the code, we can explain how this works. Every branch is named by the number of the first opcode in that branch:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #1&lt;/code&gt; is the assignment of &lt;code&gt;$i&lt;/code&gt; in line 4.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #3&lt;/code&gt; is the &lt;em&gt;loop test&lt;/em&gt; in line 4. If the condition doesn't match, we jump to &lt;code&gt;op #18&lt;/code&gt; on line 16 that echos the newline.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #9&lt;/code&gt; is the &lt;code&gt;if&lt;/code&gt; condition on line 6.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #12&lt;/code&gt; is when the &lt;code&gt;if&lt;/code&gt; condition returns true and&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #15&lt;/code&gt; is when the &lt;code&gt;if&lt;/code&gt; condition returns false.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #17&lt;/code&gt; sits behind both &lt;code&gt;op #12&lt;/code&gt; and &lt;code&gt;op #15&lt;/code&gt; and makes sure there is a jump to the counting expression in &lt;code&gt;#op 6&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;op #6&lt;/code&gt; is the post increment operation on line 4 which will then again be followed by &lt;code&gt;op #3&lt;/code&gt; to check whether the end of the loop has been reached.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;This is of course a very simple example, but it also works for (multiple) classes and functions in a file. You just need to make sure to tell VLD that you don't want the code &lt;em&gt;executed&lt;/em&gt; as the output could be very large. You can use the &lt;code&gt;vld.execute=0&lt;/code&gt; php.ini setting for that.&lt;/p&gt;
      &lt;p&gt;I hope this new functionality can spread some light on how loops etc. work in PHP. In order to play with the code, you need to check-out VLD from my SVN with &lt;code&gt;svn co svn://svn.xdebug.org/svn/php/vld/trunk vld&lt;/code&gt;. You can also view the code on-line at &lt;a href="http://svn.xdebug.org/cgi-bin/viewvc.cgi/vld/trunk/?root=php"&gt;http://svn.xdebug.org/cgi-bin/viewvc.cgi/vld/trunk/?root=php&lt;/a&gt;. Look out for a new release coming soon!&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201002191145</guid>
      <pubDate>Fri, 19 Feb 2010 11:27:00 +0000</pubDate>
    </item>
  </channel>
</rss>

