View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001007 | Xdebug | public | 2013-11-27 18:11 | 2019-04-18 07:29 | |
| Reporter | prxdev | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | not fixable | ||
| Platform | Apache 2.2 / 2.4 | OS | Linux / Windows | OS Version | Fedora 17/ Windo |
| Product Version | 2.2.3 | ||||
| Summary | 0001007: Static Variables are showing "uninitialized" when stepping through the debug process | ||||
| Description | I am calling a static class that I am initializing a static variable with a const then returning that variable to the caller. Then end result is fine, it works. The issue is, when I go into debug mode, initializing the variable is not happening. The values cannot be seen. This caused a great deal of time troubleshooting an issue that a variable was not being initialized when it really was. | ||||
| Steps To Reproduce | Run the following code:
Place a break point on the line "return self::$hello;" and check the values of the line "self::$hello = self::HELLO;" You will see "self::$hello" is not initialized to a value, but letting the program run the expected result is obtained. | ||||
| Additional Information | I have tested this on two different development environments. They are as follows: Windows 8 Professional Linux (Fedora 17) This appears to only be an issue with static variables and functions. non static variables and functions are showing variables being initialized. | ||||
| Tags | No tags attached. | ||||
| Operating System | Linux / Windows | ||||
| PHP Version | 5.5.0-5.5.4 | ||||
|
|
I have just tried this myself with the simple debugger that comes with Xdebug, and this works just fine. I've just pushed a test case to https://github.com/derickr/xdebug/tree/issue1007-static-uninitialized I am thinking that your IDE (Eclipse) is doing something wrong. Can you please make a debugging log as is described at http://xdebug.org/docs/remote#remote_log and then debug the code that you've given me? Please attach the log to this report when you're done. |
|
|
I ran the debug on Eclipse as requested and attached the log file. |
|
|
One more note, this report was ran on the Windows / Apapche 2.4 / PHP 5.5.5 configuration |
|
|
I don't think the line numbers in the log match up with the line numbers in the script. This makes it a bit tricky to follow the log. Can you add the exact script that you used to make this log please too just to be sure? That said, I think eclipse just does it wrong. It requests first the context (which shows all the variables in the local scope). This returns (see "context get -i 37" in the log):
I suggest you file a bug with Eclipse about it not requesting "::$hello" when it is supposed to do so. I'll leave the bug open to have a look at your new script, but I think my conclusion that this is an Eclipse issue will not change. |
|
|
I have attached the entire PHP solution that was created in Eclipse. This also includes the meta files for the solution. ( PHPDemo ). |
|
|
Ok, thanks for that. It does confirm my conclusion though that this is not something I can fix in Xdebug. For the first thing, its up to PHP. And for the second, it's a bug in Eclipse that it asks for $hello instead of ::$hello. If you file a bug with Eclipse, please feel free to include a link to this report here. cheers, |
|
|
prxdev Thanks |