Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/debugger/com.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,10 @@ static void xdebug_init_debugger()
xdebug_mark_debug_connection_pending();

if (!XG_DBG(context).handler->remote_init(&(XG_DBG(context)), XDEBUG_REQ)) {
/* The request could not be started, ignore it then */
/* The request could not be started, close the socket to prevent fd leak */
xdebug_log_ex(XLOG_CHAN_DEBUG, XLOG_ERR, "SES-INIT", "The debug session could not be started. Tried: %s.", connection_attempts->d);
xdebug_close_socket(XG_DBG(context).socket);
XG_DBG(context).socket = -1;
} else {
/* All is well, turn off script time outs */
zend_unset_timeout();
Expand Down Expand Up @@ -717,6 +719,7 @@ void xdebug_mark_debug_connection_not_active()
{
if (XG_DBG(remote_connection_enabled)) {
xdebug_close_socket(XG_DBG(context).socket);
XG_DBG(context).socket = -1;
}

XG_DBG(remote_connection_enabled) = 0;
Expand Down
3 changes: 2 additions & 1 deletion xdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ PHP_RINIT_FUNCTION(xdebug)
xdebug_lib_start_with_request(XDEBUG_MODE_STEP_DEBUG) ||
xdebug_lib_start_with_trigger(XDEBUG_MODE_STEP_DEBUG, NULL) ||
xdebug_lib_start_upon_error() ||
getenv("XDEBUG_SESSION_START") != NULL
getenv("XDEBUG_SESSION_START") != NULL ||
getenv("PHP_DEBUGGER_SESSION_START") != NULL
);

if (debug_requested) {
Expand Down
Loading