Xdebug Update: July 2019
This is another of the monthly update reports in which I explain what happened with Xdebug development in this past month. It will be published on the first Tuesday after the 5th of each month. Patreon supporters will get it earlier, on the first of each month. You can become a patron here to support my work on Xdebug. More supporters, means that I can dedicate more of my time to improving Xdebug.
In July, I worked on Xdebug for about 20 hours, still a little bit less than normal due to holidays. I worked on the following things:
2.8.0beta1 Release
On July 25th, the same day that PHP 7.4.0beta1 was released, I made Xdebug's 2.8.0beta1 release. PHP 7.4 had changed some internal structures that required changes in Xdebug. You have to use the Xdebug 2.8.0beta1 release with PHP 7.4.0beta1.
This first beta release mainly makes Xdebug compatible again with PHP, but also addresses a bunch of issues that were reported, including a fix for Code Coverage collections, and a few issues related to obtaining the correct PID (Process Identifier) number for debugging. It also addresses an issue with NULL bytes and the DBGp protocol.
NULL bytes in the DBGp protocol
In PHP, it is possible to have NULL bytes in variable, key, and property names by using \0, such as in:
<?php $name = "with_\0_null_char"; $$name = 42; ?>
The DBGp protocol represents variable names through the name attribute of the property element in its XML format:
<property name="$name" fullname="$name" type="string" size="16" encoding="base64">
<![CDATA[d2l0aF8AX251bGxfY2hhcg==]]>
</property>
However, if a name has a NULL character, Xdebug would generate the following XML:
<property name="$with_�_null_char" fullname="$with_�_null_char" type="int">
<![CDATA[42]]>
</property>
The problem is however, that XML does not allow for NULL bytes in attribute names. The above XML is therefore not well-formed. When the DBGp protocol was designed many many years ago, this issue was not thought off, and hence, the DBGp protocol could not represent these NULL bytes in variable, key, and property names. If you look at the first XML snippet (with name="$name"), then you can see that the DBGp protocol does handle this for the values. In this case, it added the encoding="base64" attribute, and encoded the string "with_\0_null_char" as d2l0aF8AX251bGxfY2hhcg==.
A while ago, for Xdebug 2.6, I addressed this problem by an update to the DBGp protocol to include extended properties. When the IDE enables this feature, Xdebug will then communicate names and values through a base64 encoded value in a sub-element, such as:
<property type="string" size="16">
<name encoding="base64"><![CDATA[JG5hbWU=]]></name>
<fullname encoding="base64"><![CDATA[JG5hbWU=]]></fullname>
<value encoding="base64"><![CDATA[d2l0aF8AX251bGxfY2hhcg==]]></value>
</property>
What I had failed to see is that it also possible that class names can have NULL characters in their name—when you use anonymous classes:
<?php
$a = new class { };
var_dump( $a );
?>
This would still be communicated as:
<property name="$a" fullname="$a" type="object"
classname="class@anonymous�/home/derick/dev/php/xdebug-xdebug/tests/bug01682.inc0x7efd7ab63018"
children="0" numchildren="0" page="0" pagesize="32">
</property>
The fix for issue #1682 fixes this, by checking whether either of name, value, or class name has an XML incompatible character. If that is the case, and the `extended_properties`` feature has been enabled by the IDE through the protocol, then Xdebug will communicate this value in the new format:
<property type="object" children="0" numchildren="0" page="0" pagesize="32">
<name encoding="base64"><![CDATA[JGE=]]></name>
<fullname encoding="base64"><![CDATA[JGE=]]></fullname>
<classname encoding="base64"><![CDATA[Y2xhc3NAYW5vbnltb3VzAC9ob21lL2Rlcmljay9kZXYvcGhwL3hkZWJ1Zy14ZGVidWcvdGVzdHMvYnVnMDE2ODIuaW5jMHg3ZjJjYjUxMTcwMTg=]]></classname>
</property>
Towards beta2
With the release of 2.8.0beta1 out of the way, I am now working on a series of bug fixes. I expect a beta2 or RC1 (Release Candidate) release when PHP 7.4 enters the Release Candidate phase as well.
Since beta1, I have worked on an issue with tracing and profiling: A shutdown handler, or autoprepend/autoappend file, would cause the creation of multiple files in some cases.
I have also updated the xdebug.coverage_enable=0 feature to make sure that no work towards Code Coverage information gathering is done by Xdebug, when this setting is set to 0. This should speed up your application, but Code Coverage will not work. Xdebug 3's modes will eventually address this in a more elegant way.
Podcast
I have been continuing with the PHP Internals News podcast. In this weekly podcast, I discuss in 15-30 minutes, proposed new features to the PHP language with fellow PHP internals developers. It is available on Spotify and iTunes, and through an RSS Feed. Let me know if you are a listener!
Life Line
TIL that Kingfishers can hover just like hummingbird. I'll hopefully have some reasonable shots after I've gone through my nearly thousand shots today...
I hiked 9.8km in 3h40m47s
Updated a restaurant
Updated a vacant business
I walked 7.1km in 1h16m56s
I walked 3.9km in 45m56s
I walked 1.1km in 10m47s
I think this was my favourite photo of the set that I took. It's not at maximum coverage, but it does have a sun spot group (4508) just on the cusp of the terminator.
#eclipse #eclipse2026 #SolarEclipse #London #Astronomy #AstroPhotography #Photography
No totality here in London, but still had a great evening out in the local park and taking some snaps.
I did have a nice Solar Filter that I made for my lens, and had many conversations with people from different backgrounds. Kids loves to look through my filter after I was done (ran out of battery power).
More photos later...
I walked 0.9km in 9m28s
I walked 1.2km in 19m05s
Merged pull request #1100
Fixed issue #2267: Application slow when debugger is not listening on…
I walked 4.7km in 48m18s
I walked 3.0km in 1h10m24s
Is there somebody who runs PHP on native windows (with Xdebug) and can run a simple script for me?
It must be in a file (`test.php`):
```
<?php
echo microtime(true), "\n";
xdebug_connect_to_client();
echo microtime(true), "\n";
```And run like:
php -dxdebug.log_level=11 -dxdebug.log=c:\temp\xdebug-i.log -dxdebug.client_host=localhost -dxdebug.client_port=9111 -dxdebug.mode=debug c:\temp\test.php
With the port 9111 not open.
Would love to see the output and log file (in a DM).
I walked 5.5km in 55m06s
@harry_wood This is this list of 100 Go-mistakes that I was talking about: https://100go.co/
Updated a crossing
I walked 2.1km in 20m08s
Enjoying my afternoon and evening out at Lords for some cricket!
I walked 3.2km in 38m54s
I walked 9.1km in 1h34m28s
Updated a gate
Updated a bakery shop




Shortlink
This article has a short URL available: https://drck.me/xdebug-19jul-ewq