Index: xdebug.c =================================================================== --- xdebug.c (revision 11503) +++ xdebug.c (revision 11505) @@ -323,6 +323,7 @@ STD_PHP_INI_ENTRY("xdebug.remote_port", "9000", PHP_INI_ALL, OnUpdateLong, remote_port, zend_xdebug_globals, xdebug_globals) #endif STD_PHP_INI_BOOLEAN("xdebug.remote_autostart","0", PHP_INI_ALL, OnUpdateBool, remote_autostart, zend_xdebug_globals, xdebug_globals) + STD_PHP_INI_BOOLEAN("xdebug.remote_connectback","0", PHP_INI_ALL, OnUpdateBool, remote_connectback, zend_xdebug_globals, xdebug_globals) PHP_INI_ENTRY("xdebug.allowed_clients", "", PHP_INI_SYSTEM, OnUpdateAllowedClients) PHP_INI_ENTRY("xdebug.idekey", "", PHP_INI_ALL, OnUpdateIDEKey) PHP_INI_END() @@ -1162,7 +1163,13 @@ (XG(remote_mode) == XDEBUG_REQ) ) { /* Initialize debugging session */ + if(XG(remote_connectback)) { + zval** remote_addr = NULL; + zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr); + XG(context).socket = xdebug_create_socket(Z_STRVAL_PP(remote_addr), XG(remote_port)); + } else { XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port)); + } if (XG(context).socket >= 0) { XG(remote_enabled) = 1; @@ -1664,7 +1671,13 @@ /* Start JIT if requested and not yet enabled */ if (XG(remote_enable) && (XG(remote_mode) == XDEBUG_JIT) && !XG(remote_enabled)) { + if(XG(remote_connectback)) { + zval** remote_addr = NULL; + zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr); + XG(context).socket = xdebug_create_socket(Z_STRVAL_PP(remote_addr), XG(remote_port)); + } else { XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port)); + } if (XG(context).socket >= 0) { XG(remote_enabled) = 1; XG(context).program_name = NULL; @@ -1744,7 +1757,13 @@ if (EG(error_reporting) & type) { /* Start JIT if requested and not yet enabled */ if (XG(remote_enable) && (XG(remote_mode) == XDEBUG_JIT) && !XG(remote_enabled)) { + if(XG(remote_connectback)) { + zval** remote_addr = NULL; + zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr); + XG(context).socket = xdebug_create_socket(Z_STRVAL_PP(remote_addr), XG(remote_port)); + } else { XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port)); + } if (XG(context).socket >= 0) { XG(remote_enabled) = 1; XG(context).program_name = NULL; Index: php_xdebug.h =================================================================== --- php_xdebug.h (revision 11503) +++ php_xdebug.h (revision 11505) @@ -149,7 +149,7 @@ long remote_mode; /* XDEBUG_NONE, XDEBUG_JIT, XDEBUG_REQ */ char *remote_handler; /* php3, gdb, dbgp */ zend_bool remote_autostart; /* Disables the requirement for XDEBUG_SESSION_START */ - + zend_bool remote_connectback; /* connect back to the HTTP requestor */ char *ide_key; /* from environment, USER, USERNAME or empty */ /* remote debugging globals */