View Issue Details

IDProjectCategoryView StatusLast Update
0001964XdebugStep Debuggingpublic2023-08-02 16:45
ReporterZobo Assigned Toderick  
Status feedbackResolutionopen 
PlatformWindowsOSWindowsOS Version10
Product Version3.0.4 
Target Version3.4dev 
Summary0001964: WSL UNC paths don't have needed prefix

I just ran into an issue where Xdebug is presenting a UNC path in such way I cannot map it back to original.

I executed a script from an UNC path \WSL$\UBUNTU\home\zobo\php\test1.php

Looking at phpinfo() output, php is OK with it:

$_SERVER['PHP_SELF'] => \\wsl$\Ubuntu\home\zobo\php\test1.php
$_SERVER['SCRIPT_NAME'] => \\wsl$\Ubuntu\home\zobo\php\test1.php
$_SERVER['SCRIPT_FILENAME'] => \\wsl$\Ubuntu\home\zobo\php\test1.php
$_SERVER['PATH_TRANSLATED'] => \\wsl$\Ubuntu\home\zobo\php\test1.php
$_SERVER['argv'] => Array
    [0] => \\wsl$\Ubuntu\home\zobo\php\test1.php

However Xdebug presents the files as:

[50452] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" fileuri="file://WSL%24/UBUNTU/home/zobo/php/test1.php" language="PHP" xdebug:language_version="8.0.4RC1" protocol_version="1.0" appid="50452"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>

Also true for stack:

[50452] [Step Debug] <- stack_get -i 4
[50452] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="stack_get" transaction_id="4"><stack where="{main}" level="0" type="file" filename="file://WSL%24/UBUNTU/home/zobo/php/test1.php" lineno="3"></stack></response> 

I am not sure if this is true in case of network mapped UNC paths, but I have a strong suspicion it is. See:

In case it's a normal "windows path" the url becomes file:///C:/.... So in theory I could infer that it should be prefixed with \\, but I'd rather not...

Was this already encountered?

TagsNo tags attached.
Operating System
PHP Version8.0.0-8.0.4


has duplicate 0001939 closedderick Breakpoints unresolved and skipped when web site root is a UNC path in internet information service (8.5) 



2021-04-12 20:09

reporter   ~0005825

I read this and am considering this os actually correct...


2021-04-14 08:36

reporter   ~0005826

Upon further debugging I did find other strange things:

First the case is strange:
PHP sees: $_SERVER['PHP_SELF'] => \wsl$\Ubuntu\home\zobo\php\test1.php
Xdebug sees: file://WSL%24/UBUNTU/home/zobo/php/test1.php

If I try to set a breakpoint:
[50420] [Step Debug] <- breakpoint_set -i 2 -t line -f file://WSL%24/UBUNTU/home/zobo/php/test1.php -n 4
[50420] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="; command="breakpoint_set" transaction_id="2" id="504200001"></response>

[50420] [Step Debug] <- breakpoint_list -i 3
[50420] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="; command="breakpoint_list" transaction_id="3"><breakpoint type="line" filename="file://C:/local_disk/zobo/Projects/vscode-php-debug/vscode-php-debug/testproject/WSL$/UBUNTU/home/zobo/php/test1.php" lineno="4" state="enabled" hit_count="0" hit_value="0" id="504200001"></breakpoint></response>

It's treated as relative path... This should not be valid in URL context.

So in case of windows UNCs I think the syntax should really be encoded as file:////host/path....

I guess this is a far more complex issue than I hoped for... However not being able to set a breakpoint for a UNC path is IMO a bug.


2021-04-16 16:18

administrator   ~0005851

Last edited: 2021-04-16 16:18

Xdebug handles UNC paths, and prefixes them with file:// :

This is an implementation of a specification on the MSFT website:

Which says:

Proper Syntax

For the UNC Windows file path
\laptop\My Documents\FileSchemeURIs.doc

The corresponding valid file URI in Windows is the following:

For the local Windows file path
C:\Documents and Settings\davris\FileSchemeURIs.doc

The corresponding valid file URI in Windows is:

And this is exactly what Xdebug does. So I also don't think there is a bug here.


2021-08-07 10:10

administrator   ~0005968

I still don't know what to do here... either break "Proper Syntax" that Windows and Wikipedia explain, or ignore it and suggest people mount their drive with a drive letter.


2021-08-27 17:38

reporter   ~0005995

While "WSL$" has correct casing, I wonder, what was the correct casing for "Ubuntu"?

As for PHP's output, it uses what was passed to it.
So, if you start script with "\WSL$\…" instead of "\wsl$\…", PHP will output that.


2022-07-19 12:15

reporter   ~0006348

Hi derick,

the problem is that a unc path is requested and at a single point in log file this address is interpreted as local windows file path.

requested: file://
response: file:/// (which is incorrect)

log_7_4_30_own.txt (6,941 bytes)   
[4356] Log opened at 2022-07-19 12:10:32.012137
[4356] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[4356] [Step Debug] INFO: Checking remote connect back address.
[4356] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[4356] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[4356] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 034c:2284:6de2:e1c3:3ac2:e4bf:c065:a287:9003.
[4356] [Step Debug] INFO: Connected to debugging client: 034c:2284:6de2:e1c3:3ac2:e4bf:c065:a287:9003 (from REMOTE_ADDR HTTP header). :-)
[4356] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" fileuri="file://" language="PHP" xdebug:language_version="7.4.30" protocol_version="1.0" appid="4356" idekey="PHPSTORM"><engine version="3.1.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[]]></url><copyright><![CDATA[Copyright (c) 2002-2022 by Derick Rethans]]></copyright></init>

[4356] [Step Debug] <- feature_set -i 1 -n show_hidden -v 1
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

[4356] [Step Debug] <- feature_set -i 2 -n max_depth -v 1
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

[4356] [Step Debug] <- feature_set -i 3 -n max_children -v 100
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

[4356] [Step Debug] <- feature_set -i 4 -n extended_properties -v 1
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response>

[4356] [Step Debug] <- feature_set -i 5 -n notify_ok -v 1
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response>

[4356] [Step Debug] <- stdout -i 6 -c 1
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="stdout" transaction_id="6" success="1"></response>

[4356] [Step Debug] <- status -i 7
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="status" transaction_id="7" status="starting" reason="ok"></response>

[4356] [Step Debug] <- step_into -i 8
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file://" lineno="2"></xdebug:message></response>

[4356] [Step Debug] <- eval -i 9 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="eval" transaction_id="9"><property type="bool"><![CDATA[0]]></property></response>

[4356] [Step Debug] <- eval -i 10 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="eval" transaction_id="10"><property type="bool"><![CDATA[1]]></property></response>

[4356] [Step Debug] <- eval -i 11 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="eval" transaction_id="11"><property type="string" size="36" encoding="base64"><![CDATA[bmljb3BpZXRzY2guZGV2ZWxvcGVycy55ZWxsb3dmb3gubmV0]]></property></response>

[4356] [Step Debug] <- eval -i 12 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="eval" transaction_id="12"><property type="string" size="3" encoding="base64"><![CDATA[NDQz]]></property></response>

[4356] [Step Debug] <- eval -i 13 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="eval" transaction_id="13"><property type="string" size="20" encoding="base64"><![CDATA[L2hhdmFyaWUvcGhwaW5mby5waHA=]]></property></response>

[4356] [Step Debug] <- breakpoint_set -i 14 -t line -f file:/// -n 8
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="breakpoint_set" transaction_id="14" id="43560001"></response>

[4356] [Step Debug] <- stack_get -i 15
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="stack_get" transaction_id="15"><stack where="{main}" level="0" type="file" filename="file://" lineno="2"></stack></response>

[4356] [Step Debug] <- run -i 16
[4356] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" type="stdout" encoding="base64"><![CDATA[WC1Qb3dlcmVkLUJ5OiBQSFAvNy40LjMw]]></stream>

[4356] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" type="stdout" encoding="base64"><![CDATA[DQo=]]></stream>

[4356] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" type="stdout" encoding="base64"><![CDATA[Q29udGVudC10eXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9VVRGLTg=]]></stream>

[4356] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" type="stdout" encoding="base64"><![CDATA[DQo=]]></stream>

[4356] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" type="stdout" encoding="base64"><![CDATA[DQo=]]></stream>

[4356] [Step Debug] -> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" type="stdout" encoding="base64"><![CDATA[PCFET0NUWV...0bWw+]]></stream>

[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="run" transaction_id="16" status="stopping" reason="ok"></response>

[4356] [Step Debug] <- detach -i 17
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="" command="detach" transaction_id="17" status="stopping" reason="ok"></response>

[4356] Log closed at 2022-07-19 12:10:32.246517

log_7_4_30_own.txt (6,941 bytes)   

Issue History

Date Modified Username Field Change
2021-04-11 18:52 Zobo New Issue
2021-04-12 20:09 Zobo Note Added: 0005825
2021-04-14 08:36 Zobo Note Added: 0005826
2021-04-16 16:17 derick Assigned To => derick
2021-04-16 16:17 derick Status new => feedback
2021-04-16 16:18 derick Note Added: 0005851
2021-04-16 16:18 derick Note Edited: 0005851
2021-05-14 15:31 derick Target Version => 3.1dev
2021-05-21 13:20 derick Relationship added has duplicate 0001939
2021-08-07 10:10 derick Note Added: 0005968
2021-08-27 17:38 AnrDaemon Note Added: 0005995
2021-09-01 15:33 derick Target Version 3.1dev => 3.2dev
2022-06-06 15:27 derick Target Version 3.2dev => 3.3dev
2022-07-19 12:15 dwade3 Note Added: 0006348
2022-07-19 12:15 dwade3 File Added: log_7_4_30_own.txt
2023-08-02 16:45 derick Target Version 3.3dev => 3.4dev