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
Little Owl owlet
This lovely owlet was quite easy to find in a London Park, with some help as they camouflage so well!
I saw its sibling too.
#BirdPhotography #BirdsOfFediverse #Photography #Nature #London #BirdsOfMastodon
I went to a park (Bushy Park) to look for some owls.
I found Owls (Little and Tawny), but also a Green Woodpecker and two Kingfishers.
Snaps from my camera screen, and real photos will follow, but not of the Kingfishers as they were too far away and the photos are blurry.
#london #BirdPhotogaphy #BirdsOfMastodon #Birds #photography #BirdsOfFediverse #BushyPark
I hiked 13.8km in 4h44m12s
Created a chocolate shop and a restaurant; Updated 6 restaurants and an address; Confirmed 5 restaurants, a community_centre, and 3 other objects
Created a restaurant, a fast_food, and 2 other objects; Deleted a restaurant
I walked 8.5km in 1h31m45s
Created 2 buildings and a hairdresser shop; Updated a restaurant and an estate_agent office; Confirmed a cafe
I walked 2.2km in 38m09s
Merged pull request #1096
Bump actions/checkout from 6 to 7
Merged pull request #1095
Improve Tiverton Green mapping
Created 2 gates
I walked 7.1km in 1h23m15s
I walked 1.0km in 9m24s
Realign streets. They now have much less wide corners into each other.
Updated a fast_food
I walked 9.1km in 1h35m41s
I hiked 4.7km in 3h24m10s
I walked 6.7km in 1h12m03s
I walked 7.7km in 1h47m24s
Updated a pub
Updated a pub
Created a bar; Updated a bar; Confirmed a restaurant and a bar




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