View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002158 | Xdebug | Step Debugging | public | 2023-01-23 07:04 | 2023-01-23 18:20 |
Reporter | MCo | Assigned To | derick | ||
Priority | normal | Severity | block | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 3.1.1 | ||||
Summary | 0002158: Problem debugging cURL access in a Netbeans Xdebug session | ||||
Description | In a Netbeans PHP project, I want to debug a php file called via cURL. When Netbeans starts the project in debug mode, it runs the browser to send a index.php request with XDEBUG_SESSION_START=netbeans-xdebug. But if a PHP file uses cURL to send a GET request with the debug cookie, XDEBUG send again a <init xmlns="urn:debugger_protocol_v1" ...>, but with a different appid value. | ||||
Steps To Reproduce | I join 3 files. | ||||
Additional Information | I'm using XDEBUG 3.1.1 with Netbeans IDE 15, on Windows 10 Pro, build 19045.2486. Below is the communication between XDEBUG and the Netbeans server for the 3 joined files. Start of index.php : appid="11040" <?xml version="1.0" encoding="iso-8859-1"?> Start of page2.php : appid="11040" <?xml version="1.0" encoding="iso-8859-1"?> **** waiting for cURL return Start of page3.php : appid="5372" <?xml version="1.0" encoding="iso-8859-1"?> **** no answer from the Netbeans server | ||||
Tags | No tags attached. | ||||
Operating System | Windows 10 Pro, build 19045.2486. | ||||
PHP Version | 8.1.0-8.1.4 | ||||
|
index.php (1,440 bytes)
<?php /*============================================================================== * Makes an AJAX call to page2.php ==============================================================================*/ ?> <!DOCTYPE html> <html> <head> <title>page1</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="icon" href="data:,"> <!-- no favicon --> <script> function getContent() { let response = document.getElementById('content'); let URL = "./page2.php"; fetch(URL) .then(reponse => { if ( ! reponse.ok) throw new Error("NOK - HTTP error="+reponse.status); return reponse.text(); }) .then(data => { response.innerHTML = data; return 0; }) .catch(error => { response.innerHTML = "NOK - fetch().catch() : "+error; }); } </script> </head> <body> <h2>I am page1.php</h2> <div style="background-color:lightgreen"> <h3>AJAX call of page2.php which uses cURL to get page3.php content</h3> <input type="button" onclick="getContent()" value="Call"> <p id="content"></p> </div> </body> </html> page2.php (736 bytes)
<?php /*============================================================================== * Makes a cURL call to get page3.php content. * With line 11, execution stops in debug mode ==============================================================================*/ $answer = ""; try { $ch = curl_init("http://test1.mco/page3.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Cookie: XDEBUG_SESSION=netbeans-xdebug')); $answer = curl_exec($ch); if ($answer === false) throw new Exception("curl_exec returns FALSE - curlError=".curl_error($ch)); } catch (Throwable $ex) { $answer = 'Exception '.$ex->getCode().' message='.$ex->getMessage(); } ?> <?=$answer?> |
|
The appid's are pretty much random numbers. In fact, they are the process IDs of the processes on your Windows system. The problem here is that although Xdebug will just initiate a new debug connection for every script that it sees, it seems that Netbeans can not handle more than one debugging session at one time, and instead it waits (hangs) until the original one is done. I can't fix that on the Xdebug site. I would recommend to switch to a more modern editor, such as PhpStorm of VS Code with the PHP Debug plugin. As there is nothing actionable from the Xdebug side, and no bug, I am closing this issue. |
Date Modified | Username | Field | Change |
---|---|---|---|
2023-01-23 07:04 | MCo | New Issue | |
2023-01-23 07:04 | MCo | File Added: index.php | |
2023-01-23 07:04 | MCo | File Added: page2.php | |
2023-01-23 07:04 | MCo | File Added: page3.php | |
2023-01-23 18:20 | derick | Assigned To | => derick |
2023-01-23 18:20 | derick | Status | new => resolved |
2023-01-23 18:20 | derick | Resolution | open => no change required |
2023-01-23 18:20 | derick | Note Added: 0006504 |