'I can start xdebug if trigger string is present, but how do I have it start *only* if the trigger string is present?

I'm trying to only start an xdebug session only when I pass a certain trigger string with the request via a cookie, like so:

GET https://1.2.3.4
cookie: XDEBUG_TRIGGER=mytriggerstring

Although I can get xdebug to start as planned with the trigger, I can also still start the session without the trigger using this generic request:

GET https://1.2.3.4?XDEBUG_SESSION_START=anything

Here's my complete xdebug config file:

xdebug.start_with_request=trigger
xdebug.mode=debug
xdebug.trigger_value=mytriggerstring
xdebug.client_host = 192.168.1.10

The xdebug docs here say

The functionality only gets activated when a specific trigger is present when the request starts

I'm not seeing anything there that says XDEBUG_SESSION_START has to be disabled, or how to disable it if that was needed.

What am I missing?

This is on CentOS 7 and here's my xdebug/php version:

PHP 7.4.27 (cli) (built: Dec 14 2021 17:17:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

Here are logs from xdebug.log_level=10:

..passing no xdebug params:

[661] Log opened at 2022-02-24 02:40:03.415677
[661] [Config] DEBUG: Checking if trigger 'XDEBUG_TRIGGER' is enabled for mode 'debug'
[661] [Config] INFO: Trigger value for 'XDEBUG_TRIGGER' not found, falling back to 'XDEBUG_SESSION'
[661] [Config] INFO: Trigger value for 'XDEBUG_SESSION' not found, so not activating
[661] Log closed at 2022-02-24 02:40:03.416915

..passing my trigger via the cookie:

[663] Log opened at 2022-02-24 02:40:38.079079
[663] [Config] DEBUG: Checking if trigger 'XDEBUG_TRIGGER' is enabled for mode 'debug'
[663] [Config] DEBUG: The trigger value 'mytriggerstring' matched the shared secret 'mytriggerstring' for mode 'debug'
[663] [Step Debug] INFO: Connecting to configured address/port: 192.168.1.10:9003.
[663] [Step Debug] INFO: Connected to debugging client: 192.168.1.10:9003 (through xdebug.client_host/xdebug.client_port). :-)

..passing the XDEBUG_SESSION_START=anything cgi param

[661] Log opened at 2022-02-24 02:42:39.009885
[661] [Step Debug] DEBUG: Found 'XDEBUG_SESSION_START' HTTP variable, with value 'anything'
[661] [Step Debug] INFO: Connecting to configured address/port: 192.168.1.10:9003.
[661] [Step Debug] INFO: Connected to debugging client: 192.168.1.10:9003 (through xdebug.client_host/xdebug.client_port). :-)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source