View Issue Details

IDProjectCategoryView StatusLast Update
0001417XdebugUncategorizedpublic2017-04-14 11:41
ReporterLanaZem Assigned To 
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
Description

Create 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 Reproduce

1) 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 Information

The 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

derick

2017-04-11 10: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 10:28

administrator   ~0004253

I can reproduce this easily with the great report.

derick

2017-04-14 11:41

administrator   ~0004261

Fixed for 2.5.2.