View Issue Details

IDProjectCategoryView StatusLast Update
0000893XdebugUsage problems (Wrong Results)public2017-03-19 22:17
ReporterZoboAssigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Product Version2.2.1 
Target VersionFixed in Version 
Summary0000893: Callstack invalid when __autoload initiated from class method
DescriptionIf __autoload is called as a result of accessing an unknown class from within a class method (static or instance - clazz::doSomething() or $inst->doSomething()), the call stack will have wrong file name one depth just below the autoload call.

Expected result (note filename on second line):
0: __autoload() at autoload.php:6
1: wrap->doIt() at autoload.php:17
2: {main}() at index.php:6

Actual result (note filename on second line):
0: __autoload() at autoload.php:6
1: wrap->doIt() at index.php:17
2: {main}() at index.php:6
Steps To ReproduceAttached package contains 3 files:
index.php - entry point, execute this file. Calls the class member that will create a new class that needs to be autoloaded.
autoload.php - contains the __autoload and the class method that will trigger autoload.
class.Test.php - The autoloaded class (just so that the whole script can execute, no other meaning)

__autoload() contains an xdebug_break() at the location where the issue is first visible.
Additional InformationThis is reproducible with php5.4.5/xdebug2.2.1 and php5.3.3-7+squeeze14/xdebug2.2.1.

The issue is a bit different when tested with php5.3.3-7+squeeze14/xdebug2.1.0. There the the stack depths in question have correct filename, but lineno is 0.
TagsNo tags attached.
Operating System
PHP Version5.4.4

Relationships

has duplicate 0001150 resolvedderick Traces show wrong filenames 

Activities

Zobo

2012-10-12 07:32

reporter  

xdc-test.zip (615 bytes)

Zobo

2012-10-12 07:33

reporter   ~0002359

Forgot OS:
php5.4.5/xdebug2.2.1 was tested on Win7, PHP CLI

php5.3.3-7+squeeze14/* was tested on Debian Linux, PHP CGI

derick

2016-11-27 19:01

administrator   ~0003796

I can still reproduce this with Xdebug 2.5, by adding the "xdebug_print_function_Stack()" on the place where you have the xdebug_break():

Xdebug: user triggered in /home/derick/Downloads/autoload.php on line 6

Call Stack:
    0.0002 267680 1. {main}() /home/derick/Downloads/index.php:0
    0.0004 275384 2. wrap->doIt2() /home/derick/Downloads/index.php:6
    0.0004 276280 3. __autoload($clazz = 'Test') /home/derick/Downloads/index.php:18
    0.0005 276400 4. xdebug_print_function_stack() /home/derick/Downloads/autoload.php:6

derick

2017-03-19 22:17

administrator   ~0004237

This is indeed a bug in Xdebug with PHP 5, but it works fine with PHP 7.0 and 7.1. As this is not a critical bug, I won't be fixing it.

Issue History

Date Modified Username Field Change
2012-10-12 07:32 Zobo New Issue
2012-10-12 07:32 Zobo File Added: xdc-test.zip
2012-10-12 07:33 Zobo Note Added: 0002359
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2016-11-27 19:01 derick Note Added: 0003796
2016-11-27 19:01 derick Assigned To => derick
2016-11-27 19:01 derick Status new => confirmed
2017-03-19 22:17 derick Note Added: 0004237
2017-03-19 22:17 derick Status confirmed => resolved
2017-03-19 22:17 derick Resolution open => won't fix
2017-03-19 22:17 derick Relationship added has duplicate 0001150