View Issue Details

IDProjectCategoryView StatusLast Update
0001964XdebugStep Debuggingpublic2024-08-12 13:58
ReporterZobo Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status feedbackResolutionopen 
PlatformWindowsOSWindowsOS Version10
Product Version3.0.4 
Target Version3.4dev 
Summary0001964: WSL UNC paths don't have needed prefix
Description

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="https://xdebug.org/dbgp/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[https://xdebug.org]]></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="https://xdebug.org/dbgp/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: https://github.com/xdebug/vscode-php-debug/issues/546

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

Relationships

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

Activities

Zobo

2021-04-12 20:09

reporter   ~0005825

I read this https://en.wikipedia.org/wiki/File_URI_scheme and am considering this os actually correct...

Zobo

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="https://xdebug.org/dbgp/xdebug&quot; 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="https://xdebug.org/dbgp/xdebug&quot; 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.

derick

2021-04-16 16:18

administrator   ~0005851

Last edited: 2021-04-16 16:18

Xdebug handles UNC paths, and prefixes them with file:// : https://github.com/xdebug/xdebug/blob/master/src/lib/usefulstuff.c#L310-L313

This is an implementation of a specification on the MSFT website: https://docs.microsoft.com/en-us/archive/blogs/ie/file-uris-in-windows

Which says:

<pre>
Proper Syntax

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

The corresponding valid file URI in Windows is the following:
file://laptop/My%20Documents/FileSchemeURIs.doc

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

The corresponding valid file URI in Windows is:
file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc
</pre>

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

derick

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.

AnrDaemon

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.

dwade3

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://139.138.58.141/phpinfo.php
response: file:///139.138.58.141/phpinfo.php (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="https://xdebug.org/dbgp/xdebug" fileuri="file://139.138.58.141/phpinfo.php" 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[https://xdebug.org]]></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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file://139.138.58.141/phpinfo.php" lineno="2"></xdebug:message></response>

[4356] [Step Debug] <- eval -i 9 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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:///139.138.58.141/phpinfo.php -n 8
[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="15"><stack where="{main}" level="0" type="file" filename="file://139.138.58.141/phpinfo.php" lineno="2"></stack></response>

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

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

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

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

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

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

[4356] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/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="https://xdebug.org/dbgp/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)   

Svante

2024-08-12 11:32

reporter   ~0007045

Hi all.
I have what looks like the same problem that is described here.
I am using wsl2 and windows 11.
From the point of view of Phpstorm, I get the error message:

Cannot find file ‘/home/svante/projects/myproject/bin/cli.php’ locally

In the xdebug log I get entries like:

[11181] [Step Debug] <- breakpoint_set -i 15 -t line -f file:////wsl.localhost/Ubuntu/home/svante/projects/myproject/bin/cli.php -n 10
[11181] [Step Debug] WARN: Breakpoint file name does not exist: //wsl.localhost/Ubuntu/home/svante/projects/myproject/bin/cli.php (No such file or directory).
[11181] [Step Debug] DEBUG: Setting 'has_line_breakpoints on {main} (/home/svante/projects/myproject/bin/cli.php:0)
[11181] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="breakpoint_set" transaction_id="15" id="111810001" resolved="unresolved"></response>

I tried mapping wsl to w:\, which makes little difference.

[1543] [Step Debug] <- breakpoint_set -i 15 -t line -f file://W:/home/svante/projects/myproject/bin/cli.php -n 15
[1543] [Step Debug] WARN: Breakpoint file name does not exist: W:/home/svante/projects/myproject/bin/cli.php (No such file or directory).
[1543] [Step Debug] DEBUG: Setting 'has_line_breakpoints on {main} (/home/svante/projects/myproject/bin/cli.php:0)
[1543] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug&quot; command="breakpoint_set" transaction_id="15" id="15430001" resolved="unresolved"></response>

I see that you have a "target version" to solve this problem that is set to 3.4dev, but I guess this just is default for "next version", or something like that.
I am currently running Xdebug v3.4.0alpha2-dev.
I can also see that you derick, found that it is not xdebug handling things wrong, so perhaps I am in the wrong forum.
However, I was curious to ask if there is any known development around this problem?
I will post back to this entry from the JetBrains forum, in this youtrack post:
https://youtrack.jetbrains.com/issue/WI-58406
Let me know if there is anything I can do to help debug, or otherwise.

Svante

2024-08-12 13:58

reporter   ~0007046

An extra note. In the above I focused on cli. In fpm it actually works, mapped to w:\ or not, until I press F9 (resume program).
Then I get:
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
With xdebug not enabled, the page loads fine. That last part might be some xdebug setting, looking into that now.

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
2024-08-12 11:32 Svante Note Added: 0007045
2024-08-12 13:58 Svante Note Added: 0007046