PhpStorm and Xdebug ignoring some of the file

122 views Asked by At

I'm having this weird issue where PhpStorm debugger would step into some files but not others, the project only has one route mapping and both files are on a very similar location, already reviewed things like this without any luck, my current config is as follows:

enter image description here

This is the output for my Xdebug when I run the PHP file that it won't reach.

[91] Log opened at 2023-10-13 11:04:12.557125
[91] [Step Debug] INFO: Checking for client discovery headers: 'HTTP_X_FORWARDED_FOR,REMOTE_ADDR'.
[91] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[91] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[91] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 172.27.0.1:9009.
[91] [Step Debug] WARN: Creating socket for '172.27.0.1:9009', poll success, but error: Operation now in progress (29).
[91] [Step Debug] WARN: Could not connect to client host discovered through HTTP headers, connecting to configured address/port: host.docker.internal:9009.
[91] [Step Debug] INFO: Connected to debugging client: 172.27.0.1:9009 (from REMOTE_ADDR HTTP header), host.docker.internal:9009 (fallback through xdebug.client_host/xdebug.client_port).
[91] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/bcs/assets/components/bcs/rest/index.php" language="PHP" xdebug:language_version="8.1.24RC1" protocol_version="1.0" appid="91"><engine version="3.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2023 by Derick Rethans]]></copyright></init>

[91] [Step Debug] <- eval -i 1 -- KHN0cmluZykoaW5pX2dldCgneGRlYnVnLmNvdmVyYWdlX2VuYWJsZScpLic7Jy5pbmlfZ2V0KCd4ZGVidWcucHJvZmlsZXJfZW5hYmxlJykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfYXV0b3N0YXJ0JykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfY29ubmVjdF9iYWNrJykuJzsnLmluaV9nZXQoJ3hkZWJ1Zy5yZW1vdGVfbW9kZScpKQ==
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="1"><property type="string" size="635" encoding="base64"><![CDATA[VGhpcyBzZXR0aW5nIGhhcyBiZWVuIGNoYW5nZWQsIHNlZSB0aGUgdXBncmFkaW5nIGd1aWRlIGF0IGh0dHBzOi8veGRlYnVnLm9yZy9kb2NzL3VwZ3JhZGVfZ3VpZGUjY2hhbmdlZC14ZGVidWcuY292ZXJhZ2VfZW5hYmxlO1RoaXMgc2V0dGluZyBoYXMgYmVlbiBjaGFuZ2VkLCBzZWUgdGhlIHVwZ3JhZGluZyBndWlkZSBhdCBodHRwczovL3hkZWJ1Zy5vcmcvZG9jcy91cGdyYWRlX2d1aWRlI2NoYW5nZWQteGRlYnVnLnByb2ZpbGVyX2VuYWJsZTtUaGlzIHNldHRpbmcgaGFzIGJlZW4gY2hhbmdlZCwgc2VlIHRoZSB1cGdyYWRpbmcgZ3VpZGUgYXQgaHR0cHM6Ly94ZGVidWcub3JnL2RvY3MvdXBncmFkZV9ndWlkZSNjaGFuZ2VkLXhkZWJ1Zy5yZW1vdGVfYXV0b3N0YXJ0O1RoaXMgc2V0dGluZyBoYXMgYmVlbiBjaGFuZ2VkLCBzZWUgdGhlIHVwZ3JhZGluZyBndWlkZSBhdCBodHRwczovL3hkZWJ1Zy5vcmcvZG9jcy91cGdyYWRlX2d1aWRlI2NoYW5nZWQteGRlYnVnLnJlbW90ZV9jb25uZWN0X2JhY2s7VGhpcyBzZXR0aW5nIGhhcyBiZWVuIGNoYW5nZWQsIHNlZSB0aGUgdXBncmFkaW5nIGd1aWRlIGF0IGh0dHBzOi8veGRlYnVnLm9yZy9kb2NzL3VwZ3JhZGVfZ3VpZGUjY2hhbmdlZC14ZGVidWcucmVtb3RlX21vZGU=]]></property></response>

[91] [Step Debug] <- feature_set -i 2 -n show_hidden -v 1
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="show_hidden" success="1"></response>

[91] [Step Debug] <- feature_set -i 3 -n max_depth -v 1
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_depth" success="1"></response>

[91] [Step Debug] <- feature_set -i 4 -n max_children -v 100
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="max_children" success="1"></response>

[91] [Step Debug] <- feature_set -i 5 -n extended_properties -v 1
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="extended_properties" success="1"></response>

[91] [Step Debug] <- feature_set -i 6 -n notify_ok -v 1
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="6" feature="notify_ok" success="1"></response>

[91] [Step Debug] <- feature_set -i 7 -n resolved_breakpoints -v 1
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="7" feature="resolved_breakpoints" success="1"></response>

[91] [Step Debug] <- feature_set -i 8 -n breakpoint_include_return_value -v 1
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="8" feature="breakpoint_include_return_value" success="1"></response>

[91] [Step Debug] <- stdout -i 9 -c 1
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="9" success="1"></response>

[91] [Step Debug] <- status -i 10
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="status" transaction_id="10" status="starting" reason="ok"></response>

[91] [Step Debug] <- step_into -i 11
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="11" status="break" reason="ok"><xdebug:message filename="file:///var/www/html/bcs/assets/components/bcs/rest/index.php" lineno="11"></xdebug:message></response>

[91] [Step Debug] <- eval -i 12 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="bool"><![CDATA[0]]></property></response>

[91] [Step Debug] <- eval -i 13 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="bool"><![CDATA[1]]></property></response>

[91] [Step Debug] <- eval -i 14 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="14"><property type="string" size="13" encoding="base64"><![CDATA[MTkyLjE2OC4wLjEwNA==]]></property></response>

[91] [Step Debug] <- eval -i 15 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="15"><property type="string" size="2" encoding="base64"><![CDATA[ODA=]]></property></response>

[91] [Step Debug] <- eval -i 16 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
[91] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="16"><property type="string" size="52" encoding="base64"><![CDATA[L2Jjcy9hc3NldHMvY29tcG9uZW50cy9iY3MvcmVzdC9pbmRleC5waHA/X3Jlc3Q9VXNlcg==]]></property></response>

[91] [Step Debug] <- detach -i 17
[91] [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>

[91] Log closed at 2023-10-13 11:04:12.603421

Also I'm 100% sure the script is called because I can see the output on the browser from calling it, also triggering another script inside the core folder actually starts the debugger and let's me step debug without any problems what I'm missing?

1

There are 1 answers

1
LazyOne On BEST ANSWER

According to your screenshot you have configured your "PHP | Servers" entry to use port 443 (which is HTTPS). At the same time, according to the Xdebug log the actual request is done using plain HTTP on port 80. This could be a mistake in the URL on your end or perhaps some transparent traffic proxy (nginx for example).

Duplicate that "PHP | Servers" entry and change port to 80 instead of 443. This way you will cover both access scenarios: HTTP and HTTPS.

enter image description here


P.S. It looks like you have "Ignore external connections through unregistered server configurations" option enabled in PhpStorm settings (on "PHP | Debug" settings page). If you would have it enabled then the IDE would show you a warning/dialog about unknown server configuration…

The IDE uses the server name & port pair to decide what config to use. And since you did not had the required combo and that option was enabled… PhpStorm was silently dropping the debug session (as configured by the user).

enter image description here