Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why it says that is supports phpstorm ide, when tests cases for phpstorm compatability fail #95

Closed
juslintek opened this issue Feb 22, 2021 · 27 comments

Comments

@juslintek
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provides a simple script and debug step to reproduce the problem.

make test

  1. What did you expect to see?

All passed

  1. What did you see instead?
Don't forget to run 'make test'.


=====================================================================
PHP         : /usr/local/Cellar/php/8.0.2/bin/php
PHP_SAPI    : cli
PHP_VERSION : 8.0.2
ZEND_VERSION: 4.0.2
PHP_OS      : Darwin - Darwin Linass-MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
INI actual  : /Users/juslintek/yasd/tmp-php.ini
More .INIs  :
---------------------------------------------------------------------
PHP         : /usr/local/Cellar/php/8.0.2/bin/phpdbg
PHP_SAPI    : phpdbg
PHP_VERSION : 8.0.2
ZEND_VERSION: 4.0.2
PHP_OS      : Darwin - Darwin Linass-MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
INI actual  : /Users/juslintek/yasd/tmp-php.ini
More .INIs  :
---------------------------------------------------------------------
CWD         : /Users/juslintek/yasd
Extra dirs  :
VALGRIND    : Not used
=====================================================================
TIME START 2021-02-22 09:43:21
=====================================================================
FAIL issue: 41 [tests/yasd_debugger/issue/41.phpt]
PASS opcode: getOpcodeByName [tests/yasd_debugger/opcode/getOpcodeByName.phpt]
FAIL remote_mode: breakpoint_list [tests/yasd_debugger/remote_mode/breakpoint_list.phpt]
FAIL remote_mode: breakpoint_set [tests/yasd_debugger/remote_mode/breakpoint_set/breakpoint_set.phpt]
TEST 5/20 [tests/yasd_debugger/remote_mode/breakpoint_set/breakpoint_set_conditiFAIL breakpoint_set: breakpoint_set_conditional_line [tests/yasd_debugger/remote_mode/breakpoint_set/breakpoint_set_conditional_line.phpt]
FAIL remote_mode: context_get [tests/yasd_debugger/remote_mode/context_get.phpt]
TEST 7/20 [tests/yasd_debugger/remote_mode/context_get/superglobal_variable.phptFAIL context_get: superglobal_variable [tests/yasd_debugger/remote_mode/context_get/superglobal_variable.phpt]
FAIL remote_mode: context_names [tests/yasd_debugger/remote_mode/context_names.phpt]
FAIL remote_mode: eval [tests/yasd_debugger/remote_mode/eval.phpt]
FAIL remote_mode: feature_set [tests/yasd_debugger/remote_mode/feature_set.phpt]
TEST 11/20 [tests/yasd_debugger/remote_mode/infinite_loop_detection/for_loop.phpFAIL infinite_loop_detection: for_loop [tests/yasd_debugger/remote_mode/infinite_loop_detection/for_loop.phpt]
TEST 12/20 [tests/yasd_debugger/remote_mode/infinite_loop_detection/goto_label_lFAIL infinite_loop_detection: goto_label_loop [tests/yasd_debugger/remote_mode/infinite_loop_detection/goto_label_loop.phpt]
TEST 13/20 [tests/yasd_debugger/remote_mode/phpstorm/compatible_with_phpstorm.phFAIL phpstorm: compatible_with_phpstorm [tests/yasd_debugger/remote_mode/phpstorm/compatible_with_phpstorm.phpt]
FAIL phpstorm: eval [tests/yasd_debugger/remote_mode/phpstorm/eval.phpt]
TEST 15/20 [tests/yasd_debugger/remote_mode/property_get/classnamme_array_key.phFAIL property_get: classnamme_array_key [tests/yasd_debugger/remote_mode/property_get/classnamme_array_key.phpt]
TEST 16/20 [tests/yasd_debugger/remote_mode/property_get/nmerical_index_array.phFAIL property_get: nmerical_index_array [tests/yasd_debugger/remote_mode/property_get/nmerical_index_array.phpt]
FAIL remote_mode: stack_get [tests/yasd_debugger/remote_mode/stack_get.phpt]
FAIL remote_mode: stdout [tests/yasd_debugger/remote_mode/stdout.phpt]
FAIL remote_mode: stop [tests/yasd_debugger/remote_mode/stop.phpt]
PASS zval: getRefCount [tests/yasd_debugger/zval/getRefCount.phpt]
=====================================================================
TIME END 2021-02-22 09:43:22

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   64
---------------------------------------------------------------------

Number of tests :   20                20
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :   18 ( 90.0%) ( 90.0%)
Tests passed    :    2 ( 10.0%) ( 10.0%)
---------------------------------------------------------------------
Time taken      :    1 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
issue: 41 [tests/yasd_debugger/issue/41.phpt]
remote_mode: breakpoint_list [tests/yasd_debugger/remote_mode/breakpoint_list.phpt]
remote_mode: breakpoint_set [tests/yasd_debugger/remote_mode/breakpoint_set/breakpoint_set.phpt]
breakpoint_set: breakpoint_set_conditional_line [tests/yasd_debugger/remote_mode/breakpoint_set/breakpoint_set_conditional_line.phpt]
remote_mode: context_get [tests/yasd_debugger/remote_mode/context_get.phpt]
context_get: superglobal_variable [tests/yasd_debugger/remote_mode/context_get/superglobal_variable.phpt]
remote_mode: context_names [tests/yasd_debugger/remote_mode/context_names.phpt]
remote_mode: eval [tests/yasd_debugger/remote_mode/eval.phpt]
remote_mode: feature_set [tests/yasd_debugger/remote_mode/feature_set.phpt]
infinite_loop_detection: for_loop [tests/yasd_debugger/remote_mode/infinite_loop_detection/for_loop.phpt]
infinite_loop_detection: goto_label_loop [tests/yasd_debugger/remote_mode/infinite_loop_detection/goto_label_loop.phpt]
phpstorm: compatible_with_phpstorm [tests/yasd_debugger/remote_mode/phpstorm/compatible_with_phpstorm.phpt]
phpstorm: eval [tests/yasd_debugger/remote_mode/phpstorm/eval.phpt]
property_get: classnamme_array_key [tests/yasd_debugger/remote_mode/property_get/classnamme_array_key.phpt]
property_get: nmerical_index_array [tests/yasd_debugger/remote_mode/property_get/nmerical_index_array.phpt]
remote_mode: stack_get [tests/yasd_debugger/remote_mode/stack_get.phpt]
remote_mode: stdout [tests/yasd_debugger/remote_mode/stdout.phpt]
remote_mode: stop [tests/yasd_debugger/remote_mode/stop.phpt]
=====================================================================

You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.	You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]: Y

Please enter your email address.
(Your address will be mangled so that it will not go out on any
mailinglist in plain text): jusys.linas@gmail.com

Posting to http://qa.php.net/buildtest-process.php

Thank you for helping to make PHP better.
make: *** [test] Error 1
  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
    uname -a
Darwin Linass-MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

php -v

PHP 8.0.2 (cli) (built: Feb  4 2021 18:57:55) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.2, Copyright (c), by Zend Technologies

gcc - v

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
@juslintek
Copy link
Author

And as expected it doesn't work with phpstorm ide so it renders it kind of usless. That command line debugging too time consuming.

@huanghantao
Copy link
Member

Your test environment is not initialized well, you can look at YASD's CI:

https://github.com/swoole/yasd/actions

@hq9000
Copy link
Contributor

hq9000 commented Mar 2, 2021

so is it expected to work with phpstorm or not?

I'm also unable to get it stop on breakpoints.

@huanghantao

@juslintek
Copy link
Author

Even if tests pass probably they do not cover actual PHPStorm behaviour. Because I cannot make a breakpoint with this extension as well. I enable that yasd would send debug requests on evey request from docker php:alpine. But it seems phpstorm ignore everything send from yasd or yasd is not sending, haven't configured logs for it to see if there is connectivity issue. But with same image, but xdebug 3 installed with xdebug.mode=debug works without any problems, unless I enable swoole extension. :D

@hq9000
Copy link
Contributor

hq9000 commented Mar 2, 2021

Btw, it's said it supports vscode. Any luck with that one?

@huanghantao
Copy link
Member

Yasd supports vscode and phpstorm. Maybe you should show me how you configure yasd?

@hq9000
Copy link
Contributor

hq9000 commented Mar 3, 2021

okay.

The php-side setup

  1. I'm running my php app in docker, the complete Dockerfile: https://gist.github.com/hq9000/f2fbb8dcf6a2a3799615064f2f9c5b5e
  2. I run the container with "host" networking and volume mapping that preserves path to my php files: /home/me -> /home/me
  3. the configuration reported by php is as follows:
root@sergey-Aspire-A315-53G:/# php --ri yasd  

yasd

Yasd => enabled
Author => codinghuang <codinghuang@qq.com>
Version => 0.3.7
Built => Mar  2 2021 15:56:17

Directive => Local Value => Master Value
yasd.breakpoints_file => no value => no value
yasd.debug_mode => remote => remote
yasd.remote_host => 127.0.0.1 => 127.0.0.1
yasd.remote_port => 9337 => 9337
yasd.depth => 1 => 1
yasd.log_level => -1 => -1
yasd.max_executed_opline_num => 0 => 0
yasd.init_file => no value => no value
xdebug.coverage_enable => 1 => 1
xdebug.profiler_enable => 1 => 1
xdebug.remote_autostart => 1 => 1
xdebug.remote_connect_back => 0 => 0
xdebug.remote_mode => req => req

root@sergey-Aspire-A315-53G:/# php -a
Interactive shell

php > print swoole_version();
4.6.3

Phpstorm-side setup

phpstorm version: 2020.1 (bit old)

configuration of the "interpreter":
image

I have a simple script where i have set breakpoints at each and every line:
image

run configuration:
image

debug settings:
image

Expectation

in the setup above, I was expecting to have the first breakpoint hit when clicking here:
image

however, it does not happen

if i click on the "bug" icon instead, it gets me this:
image

running a container from that image, i can confirm that it can reach the phpstorm's port:
image

@hq9000
Copy link
Contributor

hq9000 commented Mar 3, 2021

also i tried to enable some log by setting yasd.log_level = 3, the setting was applied:
image

but i dont' see any yasd-related logs appearing. Maybe i just don't know where to look for them.

@huanghantao
Copy link
Member

huanghantao commented Mar 3, 2021

First, click the "Listen" button instead of "Run" button:

image

Second, execute your script with -e option, for example:

php -e test.php

image

Then, it will trigger breakpoint:

image

image

@hq9000
Copy link
Contributor

hq9000 commented Mar 4, 2021

yes, the thing was that i forgot to use "-e"
now it works thank you.

this pic i'll put into a readme update i will PR shortly

image\

image

huanghantao pushed a commit that referenced this issue Mar 4, 2021
* a few notes in readme regarding using phpstorm (related to #95)

* a note regarding allowing remote connections
@huanghantao
Copy link
Member

@hq9000 Thank you!

@juslintek
Copy link
Author

juslintek commented Mar 4, 2021

Okay on my side setup is like that:
image
image
image

But when I enable swoole and yasd with above configurations, and run instead of php artisan server in docker laravels server. It does not work. I use same port as xdebug.

Do I still need to enable web cookie listening? Even if I run custom PHP Remote Debug script?

@hq9000 are you using PHP8?

Okay will try running laravels with php -e :-)

@hq9000
Copy link
Contributor

hq9000 commented Mar 4, 2021

@juslintek i use php 7.4.
and, as i run in in CLI, so can't really comment about cookies and stuff.

@huanghantao
Copy link
Member

@juslintek Yasd is not xdebug or sdebug, so you cannot use yasd in the same way as xdebug. The use of yasd is very easy, just click the listen button of phpstorm, and then execute php with -e. Don't need to configure cookies etc.

Do you use a virtual machine or container, and, you need to show me how you configure yasd:

php --ri yasd

@huanghantao
Copy link
Member

huanghantao commented Mar 4, 2021

@juslintek Can you debug the test.php file in the yasd directory?

@juslintek
Copy link
Author

@huanghantao yes.

@juslintek
Copy link
Author

Okay actually I lied, I haven't tried, when I tried with file like this:

<?php

echo "test";

$something = "black";

if ($something === "black") {
    echo true;
}

I even checked break at first line. And nothing helped. I've ran from inside alpine php docker container on which I've compiled yasd with swoole.

so I run:

php -e test.php

and IDE is not opening debug inspection view...

@juslintek
Copy link
Author

juslintek commented Mar 5, 2021

Guess I'll just go back to sdebug and wait for it to support php8, then upgrade to it. :-( As well tried to map 9000 port via docker to 9000. And I've got this error:

2021-03-05 01:29:07,497 INFO spawned: 'swoole' with pid 22
[yasd] recv command error, connection closed
2021-03-05 01:29:07,550 INFO exited: swoole (exit status 0; not expected)
Horizon started successfully.
2021-03-05 01:29:10,528 INFO spawned: 'swoole' with pid 30
[yasd] recv command error, connection closed
2021-03-05 01:29:10,573 INFO exited: swoole (exit status 0; not expected)
2021-03-05 01:29:13,580 INFO spawned: 'swoole' with pid 43
[yasd] recv command error, connection closed

Guess it doesn't matter because php is sending package from anywhere it is executed to target server deubg listener.

@juslintek
Copy link
Author

So final result of YASD is that it is not working with PHPStorm 2020.3.2 and latest Early Access, while using Docker.

@gotys
Copy link

gotys commented Mar 17, 2021

I confirm that YASD works with PhpStorm 2020.3 , with breakpoints and everything.
If you want your breakpoints to work , you have to set your IDE for remote file mappings.

Tested with phpswoole/swoole:4.6.4-php8.0 inside Docker

xdebug

@superdav42
Copy link

Anyone get PhpStorm and YASD to work without using docker? I just compiled yasd 0.3.7 manually and would expect it to work without needing to map any paths. It's connecting to PhpStorm just not stopping and any of the breakpoints set. Same results using master branch.

 php --ri yasd

yasd

Yasd => enabled
Author => codinghuang <codinghuang@qq.com>
Version => 0.3.7
Built => Mar 23 2021 13:16:05

Directive => Local Value => Master Value
yasd.breakpoints_file => no value => no value
yasd.debug_mode => remote => remote
yasd.remote_host => 127.0.0.1 => 127.0.0.1
yasd.remote_port => 9000 => 9000
yasd.depth => 1 => 1
yasd.log_level => 3 => 3
yasd.max_executed_opline_num => 0 => 0
xdebug.coverage_enable => 1 => 1
xdebug.profiler_enable => 1 => 1
xdebug.remote_autostart => 1 => 1
xdebug.remote_connect_back => 0 => 0
xdebug.remote_mode => req => req

NetBeans debug config just like shown above and release 2020.3.3.
I am invoking with -e like php -e test.php

What could the problem be? Is there any more resources like debug logs I can use to troubleshoot this? It seems PhpStorm is not passing the breakpoints correctly to yasd but I don't know where to begin to correct it.

@juslintek
Copy link
Author

juslintek commented Apr 6, 2021

Anyone get PhpStorm and YASD to work without using docker? I just compiled yasd 0.3.7 manually and would expect it to work without needing to map any paths. It's connecting to PhpStorm just not stopping and any of the breakpoints set. Same results using master branch.

 php --ri yasd

yasd

Yasd => enabled
Author => codinghuang <codinghuang@qq.com>
Version => 0.3.7
Built => Mar 23 2021 13:16:05

Directive => Local Value => Master Value
yasd.breakpoints_file => no value => no value
yasd.debug_mode => remote => remote
yasd.remote_host => 127.0.0.1 => 127.0.0.1
yasd.remote_port => 9000 => 9000
yasd.depth => 1 => 1
yasd.log_level => 3 => 3
yasd.max_executed_opline_num => 0 => 0
xdebug.coverage_enable => 1 => 1
xdebug.profiler_enable => 1 => 1
xdebug.remote_autostart => 1 => 1
xdebug.remote_connect_back => 0 => 0
xdebug.remote_mode => req => req

NetBeans debug config just like shown above and release 2020.3.3.
I am invoking with -e like php -e test.php

What could the problem be? Is there any more resources like debug logs I can use to troubleshoot this? It seems PhpStorm is not passing the breakpoints correctly to yasd but I don't know where to begin to correct it.

Seems like its not working for me. If I run php -e while yasd is enabled I get this problem: #99

If I run without -e still it is not working, probably because it must know IP address to send debug data to, but it cannot resolve my IP still inside of docker, while xdebug can but I get instant oom and have to kill all docker :D

As well why it is closed if its is not resolved to full extent. :-)

@huanghantao
Copy link
Member

@superdav42 You can configure the following configuration:

yasd.log_level=0

You will get a file called debug.log in your current directory.

@huanghantao
Copy link
Member

@superdav42 It is recommended that you first debug the test.php file under the yasd directory, and then debug your own project after success.

@ollosh
Copy link

ollosh commented Apr 7, 2021

@gotys What is your server setup? I have [yasd] connection refused issues popping up when I try to run php -e test.php inside my docker container

@hq9000 Can you also share your path mapping? Are you running the debugging script from within the container or from the outside

@domgraziano
Copy link

@gotys What is your server setup? I have [yasd] connection refused issues popping up when I try to run php -e test.php inside my docker container

same here

@deminy
Copy link
Member

deminy commented Jul 23, 2021

How to debug a Swoole-based web server using yasd (Yet Another Swoole Debugger) in Phpstorm?

Please check here: https://github.com/swoole/docker-swoole/tree/master/examples/35-debug-with-yasd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants