View Issue Details

IDProjectCategoryView StatusLast Update
0001417XdebugUsage problems (Wrong Results)public2017-04-14 12:41
ReporterLanaZemAssigned Toderick 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version2.5.1 
Target Version2.5.2Fixed in Version2.5.2 
Summary0001417: Switching from global function to static method crashes execution
DescriptionCreate a script with a static method and global function, call a global function within a static method.

If script is paused inside global function retrieving parent context will crash execution, i.e.

<- context_get -i 16 -d 1 -c 0
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="16" status="stopping" reason="ok"></response>

I've attached the whole log file to the issue.
Steps To Reproduce1) Create a php script:

<?php

class Bar {
    public static function f2() {
        foo();
    }
}

function foo() {
    echo "hi"; // put breakpoint here
}

Bar::f2();

2) Put a breakpoint on "echo "hi"" line and start debugging.

3) Try to retrieve context for `Bar::f2()`.

Expected:
Local context for `Bar::f2()` is retrieved.

Actual:
Execution crashes with "PHP Fatal error: Cannot access self:: when no class scope is active"
Additional InformationThe issue is reproduced for XDebug 2.5.1 + PHP 7.1.1.

The issue is *not* reproducible if `Bar::f2()` is not static.

Corresponding PhpStorm issue: https://youtrack.jetbrains.com/issue/WI-35562
TagsNo tags attached.
Operating System
PHP Version7.1.0-7.1.4

Activities

LanaZem

2017-04-11 10:38

reporter  

xdebug.log (20,870 bytes)

derick

2017-04-11 11:21

administrator   ~0004252

I've changed this from "crash" to "major". "crash" is meant for when the PHP actually segfaults.

I'll have a look at this.

derick

2017-04-11 11:28

administrator   ~0004253

I can reproduce this easily with the great report.

derick

2017-04-14 12:41

administrator   ~0004261

Fixed for 2.5.2.

Issue History

Date Modified Username Field Change
2017-04-11 10:38 LanaZem New Issue
2017-04-11 10:38 LanaZem File Added: xdebug.log
2017-04-11 11:21 derick Note Added: 0004252
2017-04-11 11:21 derick Severity crash => major
2017-04-11 11:21 derick Status new => acknowledged
2017-04-11 11:21 derick Target Version => 2.5.2
2017-04-11 11:28 derick Note Added: 0004253
2017-04-11 11:28 derick Assigned To => derick
2017-04-11 11:28 derick Status acknowledged => assigned
2017-04-14 12:41 derick Note Added: 0004261
2017-04-14 12:41 derick Status assigned => closed
2017-04-14 12:41 derick Resolution open => fixed
2017-04-14 12:41 derick Fixed in Version => 2.5.2