View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001581 | Xdebug | Uncategorized | public | 2018-10-17 01:33 | 2018-10-17 15:18 |
| Reporter | pablosoria8286 | Assigned To | |||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | no change required | ||
| Platform | Linux | OS | Ubuntu | OS Version | 18.04 |
| Product Version | 2.6.1 | ||||
| Summary | 0001581: Local variables/function variables not shown when OPcache is enabled | ||||
| Description | If you try to debug the code below with OPCache enabled and put a breakpoint in the local variables you will see that they are not displayed. If you deactivate OPCache everything works as expected. Important to notice that OPcache is correctly activated first than Xdebug and that if you want to test it through cli you have to activate OPcache (by default is off on cli). | ||||
| Steps To Reproduce | Sample Code:function hello($name){ echo hello("World");In fact the variable $localVariable doesn't even appear in the log file.
| ||||
| Additional Information | PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS ) | ||||
| Tags | No tags attached. | ||||
| Operating System | Ubuntu 18.04 | ||||
| PHP Version | 7.2.10-7.2.14 | ||||
|
|
Hi, This is a feature of OPCache. It optimised PHP code by sometimes removing variables if they are not needed. If you look at the opcodes that are generated, you see the following for your first example:
function name: hello number of ops: 7 compiled vars: !0 = $name line #* E I O op fetch ext return operands 2 0 E > EXT_NOP branch: # 0; line: 2- 4; sop: 0; eop: 6; out0: -2 There is no sign of $localVariable, and the "2" is just used inline in opcode 5 (the FAST_CONCAT). There is nothing I can do about this, and I would recommend you disable OPCache when debugging. cheers, |