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
I've finished reading This Way Up. It's about maps, that went wrong.
It's a good read, but htyerr were several chapters that were written in a novel way (as a video transcript, a series of letters), and I found distracting from the a tail content. It'll have worked better in a produced video.
No mention of @openstreetmap though :-(
Updated a bench
Created a tree; Updated 3 humps and a waste_basket
The Early Cormorant Catches the Eel
Sorry, not the best photo! But I caught this Cormorant catching this large eel when looking for Bank Swallows, right next to Eel Pie Island in the Thames.
#Birds #BirdPhotography #BirdsOfMastodon #Photography #London
Updated an estate_agent office
I went to my nieces' birthday party yesterday.
The theme was pink, and that included all the food, mostly died with beet root.
Shock and horror this morning when doing number two. Not only was my turd dark red, it was also glittering at me. Apparently the carrot cake had edible glitter...
So now I know what's worse than glitter.
😂 ✨ 💩 🟣Long-Tailed Tit on a Branch with Lichen
I've been spending some time in random London local nature reserves.
Sitting and listening, and in fifteen minutes you spot countless species.
This one was in Ham Lands Local Nature Reserve near Teddington.
#london #BirdPhotogaphy #BirdsOfMastodon #Birds #LichenSubscribe
A Colourful Mandarin
In The Long Water in Kensington Palace Gardens, London.
Created 7 benches
Created 2 benches
Created a bench
I walked 7.3km in 2h28m39s
Added a note about a duplicate Papersmiths
I walked 4.1km in 49m02s
Fixed website
fix typo
Updated a bench
I walked 1.6km in 20m26s
I walked 1.1km in 11m49s
The Yellow Eye
A blue heron's head, with its very yellow stare-y eye.
#BirdPhotography #Photography #BirdsOfFediverse #BirdsOfMastodon #London
My little Lego box is telling me it really is quite warm outside.
Created a bicycle_parking and a crossing
I walked 3.3km in 41m56s








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