diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index af86db7..808e1e3 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -1044,6 +1044,19 @@ protected function curlExec($curl_options, $redirect = FALSE) { // not overwritten by Curl. $curl_options[CURLOPT_HTTPHEADER][] = 'Expect:'; } + + // Forward xdebug session. + if (isset($_COOKIE['XDEBUG_SESSION'])) { + $curl_options += array( + CURLOPT_COOKIE => '', + ); + // Ensure any existing cookie data string ends with the correct separator. + if (!empty($curl_options[CURLOPT_COOKIE])) { + $curl_options[CURLOPT_COOKIE] = rtrim($curl_options[CURLOPT_COOKIE], '; ') . '; '; + } + $curl_options[CURLOPT_COOKIE] .= 'XDEBUG_SESSION=' . $_COOKIE['XDEBUG_SESSION'] . '; '; + } + curl_setopt_array($this->curlHandle, $this->additionalCurlOptions + $curl_options); if (!$redirect) {