PhpStorm 捕获它应该跳过的请求 (xdebug.remote_autostart=0)

PhpStorm catches requests it should skip (xdebug.remote_autostart=0)

我将 Xdebug 配置为在存在 GET/POST/COOKIE 变量时启动远程调试会话:xdebug.remote_autostart=0。但是 PhpStorm 会在每个请求上激活调试,而不管变量如何。

PhpStorm 配置:

Xdebug 配置:

xdebug support => enabled
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
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.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 => 500 => 500
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => 2 => 2
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => Off => Off
xdebug.profiler_enable_trigger => On => On
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 => On => On
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_host => localhost => localhost
xdebug.remote_log => /var/www/public/var/log/xdebug.log => /var/www/public/var/log/xdebug.log
xdebug.remote_log_level => 7 => 7
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
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

$_GLOBAL 来自 PhpStorm:

array (
  '_GET' => 
  array (
  ),
  '_POST' => 
  array (
  ),
  '_COOKIE' => 
  array (
  ),
  '_FILES' => 
  array (
  ),
  '_SERVER' => 
  array (
    'HOSTNAME' => '*****',
    'PUPPET_AGENT_VERSION' => '6.10.0',
    'PWD' => '/var/www/public',
    'PHPFPM_USER' => '1000',
    'XDEBUG_CONFIG' => 'remote_host=',
    'HOME' => '/var/www',
    'PHP_IDE_CONFIG' => 'serverName='*****',
    'NR_INSTALL_APP' => '\'PHP Application\'',
    'CODENAME' => 'stretch',
    'SHLVL' => '0',
    'APPLICATION_MODE' => 'development',
    'NR_INSTALL_KEY' => '\'\'',
    'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
    'R10K_VERSION' => '3.3.2',
    'DEBIAN_FRONTEND' => 'noninteractive',
    'USER' => 'www-data',
    'HTTP_TE' => 'trailers',
    'HTTP_UPGRADE_INSECURE_REQUESTS' => '1',
    'HTTP_DNT' => '1',
    'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, br',
    'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.5',
    'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0',
    'HTTP_HOST' => ''*****',
    'REDIRECT_STATUS' => '200',
    'SERVER_NAME' => ''*****',
    'SERVER_PORT' => '443',
    'SERVER_ADDR' => ''*****,
    'REMOTE_PORT' => '41162',
    'REMOTE_ADDR' => ''*****',
    'SERVER_SOFTWARE' => 'nginx/1.17.4',
    'GATEWAY_INTERFACE' => 'CGI/1.1',
    'HTTPS' => 'on',
    'REQUEST_SCHEME' => 'https',
    'SERVER_PROTOCOL' => 'HTTP/2.0',
    'DOCUMENT_ROOT' => '/var/www/public/pub',
    'DOCUMENT_URI' => '/index.php',
    'REQUEST_URI' => '/',
    'SCRIPT_NAME' => '/index.php',
    'CONTENT_LENGTH' => '',
    'CONTENT_TYPE' => '',
    'REQUEST_METHOD' => 'GET',
    'QUERY_STRING' => '',
    'SCRIPT_FILENAME' => '/var/www/public/pub/index.php',
    'MAGE_RUN_CODE' => 'fr_FR',
    'MAGE_RUN_TYPE' => 'store',
    'PHP_VALUE' => 'memory_limit=768M 
 max_execution_time=18000',
    'PHP_FLAG' => 'session.auto_start=off 
 suhosin.session.cryptua=off',
    'FCGI_ROLE' => 'RESPONDER',
    'PHP_SELF' => '/index.php',
    'REQUEST_TIME_FLOAT' => 1586156187.1087,
    'REQUEST_TIME' => 1586156187,
  ),
  '_REQUEST' => 
  array (
  ),
  '_ENV' => 
  array (
  ),
)

你在 $_SERVER 输出下有 'XDEBUG_CONFIG' => 'remote_host=',这通常是通过环境变量设置的(我假设你在这里使用了一些 Docker 容器或类似的东西)。

如果 XDEBUG_CONFIG 环境变量存在,则 Xdebug 将请求视为标准 "debug me" 标志 (GET/POST/COOKIE) 存在。您可以在 Xdebug 文档中查看更多信息:https://xdebug.org/docs/remote


关于相关说明(不是你的情况,因为你的变量不为空),但我认为它仍然值得一提:https://bugs.xdebug.org/view.php?id=1608