View Issue Details

IDProjectCategoryView StatusLast Update
0001964XdebugStep Debuggingpublic2021-09-01 15:33
ReporterZobo Assigned Toderick  
Status feedbackResolutionopen 
PlatformWindowsOSWindowsOS Version10
Product Version3.0.4 
Target Version3.2dev 
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.

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