0

I am struggling configuring Devilbox, PhpStorm and Xdebug in order to debug my WordPress plugin. I followed Devilbox documentation for setting path mappings properly, Xdebug is configured correctly.

I can normally debug in certain PHP files f.e.: PHP code used in plugin settings page(on page load fetch DB entries), but Xdebug/PhpStorm fails to stop at breakpoints in other files that doesn't use browser window to trigger code execution.

F.e.: I use WP REST API (wp-json/something/) to catch transaction callback in my child theme and forward data to my plugin, but PhpStorm somehow skips breakpoint at that file. Code at that line executes 100%, because I log data at next line.

Path mapping for Devilbox should be correct. I use Postman to fake transaction requests on my local environment. I use Firefox Xdebug extension with Debug mode.

Is anyone experiencing similar problems? I spent hours trying to get this thing to work with zero success.

Here is xDebug PHP info:


    xdebug support  enabled
    Version     2.7.0
    IDE Key     PHPSTORM
    Supported protocols
    DBGp - Common DeBuGger Protocol

    Directive   Local Value Master Value
    xdebug.auto_trace   Off Off
    xdebug.cli_color    0   0
    xdebug.collect_assignments  Off Off
    xdebug.collect_includes On  On
    xdebug.collect_params   0   0
    xdebug.collect_return   Off Off
    xdebug.collect_vars Off Off
    xdebug.coverage_enable  On  On
    xdebug.default_enable   On  On
    xdebug.dump.COOKIE  no value    no value
    xdebug.dump.ENV no value    no value
    xdebug.dump.FILES   no value    no value
    xdebug.dump.GET no value    no value
    xdebug.dump.POST    no value    no value
    xdebug.dump.REQUEST no value    no value
    xdebug.dump.SERVER  no value    no value
    xdebug.dump.SESSION no value    no value
    xdebug.dump_globals On  On
    xdebug.dump_once    On  On
    xdebug.dump_undefined   Off Off
    xdebug.extended_info    On  On
    xdebug.file_link_format no value    no value
    xdebug.filename_format  no value    no value
    xdebug.force_display_errors Off Off
    xdebug.force_error_reporting    0   0
    xdebug.gc_stats_enable  Off Off
    xdebug.gc_stats_output_dir  /tmp    /tmp
    xdebug.gc_stats_output_name gcstats.%p  gcstats.%p
    xdebug.halt_level   0   0
    xdebug.idekey   PHPSTORM    PHPSTORM
    xdebug.max_nesting_level    256 256
    xdebug.max_stack_frames -1  -1
    xdebug.overload_var_dump    2   2
    xdebug.profiler_aggregate   Off Off
    xdebug.profiler_append  Off Off
    xdebug.profiler_enable  Off Off
    xdebug.profiler_enable_trigger  Off Off
    xdebug.profiler_enable_trigger_value    no value    no value
    xdebug.profiler_output_dir  /tmp    /tmp
    xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
    xdebug.remote_addr_header   no value    no value
    xdebug.remote_autostart Off Off
    xdebug.remote_connect_back  Off Off
    xdebug.remote_cookie_expire_time    3600    3600
    xdebug.remote_enable    On  On
    xdebug.remote_handler   dbgp    dbgp
    xdebug.remote_host  10.254.254.254  10.254.254.254
    xdebug.remote_log   no value    no value
    xdebug.remote_mode  req req
    xdebug.remote_port  9001    9001
    xdebug.remote_timeout   200 200
    xdebug.scream   Off Off
    xdebug.show_error_trace Off Off
    xdebug.show_exception_trace Off Off
    xdebug.show_local_vars  Off Off
    xdebug.show_mem_delta   Off Off
    xdebug.trace_enable_trigger Off Off
    xdebug.trace_enable_trigger_value   no value    no value
    xdebug.trace_format 0   0
    xdebug.trace_options    0   0
    xdebug.trace_output_dir /tmp    /tmp
    xdebug.trace_output_name    trace.%c    trace.%c
    xdebug.var_display_max_children 128 128
    xdebug.var_display_max_data 512 512
    xdebug.var_display_max_depth    3   3

MultiHunter
  • 123
  • 2
  • 10
  • 1
    So .. how do you call those "other scripts"? Most likely Xdebug does not see "debug me" flag (a cookie or get/post param). If you configured Xdebug to wait for such flag (default Xdebug setting) then it may never see it... – LazyOne Apr 16 '19 at 17:34
  • I consume POST request in child theme, filter parameters and then call my plugin function via action hook. What kind of flag do you have in mind? – MultiHunter Apr 16 '19 at 17:49
  • 1
    Omg... just when I was about to lose hope after 2 days, I found solution. Problem was only accuring when using Postman. Just add ?XDEBUG_SESSION_START=PHPSTORM to the end of HTTP request, and all breakpoints will be triggered. Other helpful comments: https://stackoverflow.com/questions/19139803/xdebug-and-restful-server-using-phpstorm-or-postman – MultiHunter Apr 16 '19 at 18:14
  • 1
    So .. missing GET parameter. **P.S.** I still recommend using COOKIE for this -- less editing/switching I guess as cookie can be set per domain so will not be sent for production/test URL and only for dev one. – LazyOne Apr 16 '19 at 20:25
  • I a, using mostly POST requests and works well. COOKIE is better yes, but I had problem setting it up, so I ended up with GET parameter. Thanks for help! – MultiHunter Apr 18 '19 at 06:01

0 Answers0