View Issue Details

IDProjectCategoryView StatusLast Update
0001253XdebugStep Debuggingpublic2021-11-10 15:44
Reporteraazon Assigned Toderick  
PriorityhighSeverityblockReproducibilityalways
Status resolvedResolutionno change required 
OSUbuntuOS Version14.04.3 
Product Version2.3.3 
Summary0001253: Can not view private property from nested class
Description

This error occurs in xdebug 2.3.3 and further versions.
My IDE is PhpStorm 10.0.3.
I try to take a look at private property of class from nested class in debug panel. Every time when I do so xdebug tries to access private property by calling magic __get() method and this leads to exit from program execution.

There is also some entries from xdebug log:

<- property_get -i 171 -n $son->*Dad*secrets -d 0 -c 0 -p 0
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="171"><property name="$son->*Dad*secrets" fullname="$son->*Dad*secrets" address="140089514613800" type="array" children="1" numchildren="4" page="0" pagesize="100"><property name="0" fullname="$son->*Dad*secrets[0]" address="140089514604272" type="string" size="5" encoding="base64"><![CDATA[VGhlcmU=]]></property><property name="1" fullname="$son->*Dad*secrets[1]" address="140089514604224" type="string" size="2" encoding="base64"><![CDATA[aXM=]]></property><property name="2" fullname="$son->*Dad*secrets[2]" address="140089514604176" type="string" size="7" encoding="base64"><![CDATA[bm90aGluZw==]]></property><property name="3" fullname="$son->*Dad*secrets[3]" address="140089514613632" type="string" size="4" encoding="base64"><![CDATA[aGVyZQ==]]></property></property></response>
Steps To Reproduce

Save the following code as test.php

<?php

class Dad
{
    private $secrets = [
        'There',
        'is',
        'nothing',
        'here',
    ];

    public function getSecrets()
    {
        return $this->secrets;
    }
}

class Son extends Dad
{
    public function __get($key)
    {
        exit('WTF! ' . $key);
    }
}

$son = new Son();
$secrets = $son->getSecrets();

var_dump($secrets);

Run from command line with disabled xdebug: php test.php
Output is the following:

array(4) {
  [0] =>
  string(5) "There"
  [1] =>
  string(2) "is"
  [2] =>
  string(7) "nothing"
  [3] =>
  string(4) "here"
}

Put a breakpoint in the line with var_dump() call.
Run the same command with enabled xdebug.
PhpStorm will stop execution on breakpoint.
Go to Debugger/Variables panel.
Expand $son variable
Expand $son->secret variable
Execution will be halted and the following message written to sdtout: WTF! *Dad*secrets

TagsNo tags attached.
Operating System
PHP Version5.6.15-5.6.19

Activities

derick

2016-01-19 22:36

administrator   ~0003428

Could you please provide a full debugging log that is made against the script that you provided in this report? It helps me trying to reproduce, and fix, the problem.

derick

2016-02-08 21:10

administrator   ~0003457

Can you please answer the questions from the previous note? There are instructions at https://xdebug.org/support.php#remote now too.

aazon

2016-02-11 15:33

reporter   ~0003480

Sorry for late response.
Here is my log:

Log opened at 2016-02-11 15:31:44
I: Checking remote connect back address.
W: Remote address not found, connecting to configured address/port: 10.0.2.2:9000. :-|
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; fileuri="file:///home/vagrant/xdebug.dev/xdebug.php" language="PHP" protocol_version="1.0" appid="25975" idekey="vagrant"><engine version="2.3.3"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]>&lt;/url>&lt;copyright>&lt;![CDATA[Copyright (c) 2002-2015 by Derick Rethans]]></copyright></init>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- status -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="status" transaction_id="4" status="starting" reason="ok"></response>

<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="step_into" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///home/vagrant/xdebug.dev/xdebug.php" lineno="4"></xdebug:message></response>

<- eval -i 6 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="eval" transaction_id="6"><property address="140727125793376" type="bool"><![CDATA[1]]></property></response>

<- eval -i 7 -- KHN0cmluZykoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="eval" transaction_id="7"><property address="140727125793376" type="string" size="21" encoding="base64"><![CDATA[c2VydmVyTmFtZT14ZGVidWcuZGV2]]></property></response>

<- breakpoint_set -i 8 -t line -f file:///home/vagrant/xdebug.dev/xdebug.php -n 29
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="breakpoint_set" transaction_id="8" id="259750001"></response>

<- stack_get -i 9
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="stack_get" transaction_id="9"><stack where="{main}" level="0" type="file" filename="file:///home/vagrant/xdebug.dev/xdebug.php" lineno="4"></stack></response>

<- run -i 10
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="run" transaction_id="10" status="break" reason="ok"><xdebug:message filename="file:///home/vagrant/xdebug.dev/xdebug.php" lineno="29"></xdebug:message></response>

<- stack_get -i 11
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="stack_get" transaction_id="11"><stack where="{main}" level="0" type="file" filename="file:///home/vagrant/xdebug.dev/xdebug.php" lineno="29"></stack></response>

<- context_names -i 12 -d 0
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="context_names" transaction_id="12"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

<- context_get -i 13 -d 0 -c 0
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="context_get" transaction_id="13" context="0"><property name="$secrets" fullname="$secrets" address="139890200421352" type="array" children="1" numchildren="4" page="0" pagesize="100"><property name="0" fullname="$secrets[0]" address="139890200411800" type="string" size="5" encoding="base64"><![CDATA[VGhlcmU=]]></property><property name="1" fullname="$secrets[1]" address="139890200411752" type="string" size="2" encoding="base64"><![CDATA[aXM=]]></property><property name="2" fullname="$secrets[2]" address="139890200411704" type="string" size="7" encoding="base64"><![CDATA[bm90aGluZw==]]></property><property name="3" fullname="$secrets[3]" address="139890200421184" type="string" size="4" encoding="base64"><![CDATA[aGVyZQ==]]></property></property><property name="$son" fullname="$son" address="139890200423576" type="object" classname="Son" children="1" numchildren="1" page="0" pagesize="100"><property name="Dadsecrets" fullname="$son->Dadsecrets" facet="private" address="139890200421352" type="array" children="1" numchildren="4"></property></property></response>

<- context_get -i 14 -d 0 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="context_get" transaction_id="14" context="1"><property name="$_COOKIE" fullname="$_COOKIE" address="139890200401000" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_ENV" fullname="$_ENV" address="139890200402424" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_FILES" fullname="$_FILES" address="139890200401224" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_GET" fullname="$_GET" address="139890200400024" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_POST" fullname="$_POST" address="139890200400776" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_REQUEST" fullname="$_REQUEST" address="139890200402648" type="array" children="0" numchildren="0" page="0" pagesize="100"></property><property name="$_SERVER" fullname="$_SERVER" address="139890200402872" type="array" children="1" numchildren="32" page="0" pagesize="100"><property name="LESSOPEN" fullname="$_SERVER['LESSOPEN']" address="139890200403048" type="string" size="22" encoding="base64"><![CDATA[fCAvdXNyL2Jpbi9sZXNzcGlwZSAlcw==]]></property><property name="MAIL" fullname="$_SERVER['MAIL']" address="139890200403320" type="string" size="17" encoding="base64"><![CDATA[L3Zhci9tYWlsL3ZhZ3JhbnQ=]]></property><property name="SSH_CLIENT" fullname="$_SERVER['SSH_CLIENT']" address="139890200403504" type="string" size="17" encoding="base64"><![CDATA[MTAuMC4yLjIgNjIwODIgMjI=]]></property><property name="USER" fullname="$_SERVER['USER']" address="139890200403688" type="string" size="7" encoding="base64"><![CDATA[dmFncmFudA==]]></property><property name="SHLVL" fullname="$_SERVER['SHLVL']" address="139890200403864" type="string" size="1" encoding="base64"><![CDATA[MQ==]]></property><property name="HOME" fullname="$_SERVER['HOME']" address="139890200404040" type="string" size="13" encoding="base64"><![CDATA[L2hvbWUvdmFncmFudA==]]></property><property name="SSH_TTY" fullname="$_SERVER['SSH_TTY']" address="139890200404216" type="string" size="10" encoding="base64"><![CDATA[L2Rldi9wdHMvMg==]]></property><property name="HM_APPLICATION_ENV" fullname="$_SERVER['HM_APPLICATION_ENV']" address="139890200404392" type="string" size="11" encoding="base64"><![CDATA[ZGV2ZWxvcG1lbnQ=]]></property><property name="XDEBUG_CONFIG" fullname="$_SERVER['XDEBUG_CONFIG']" address="139890200404592" type="string" size="20" encoding="base64"><![CDATA[cmVtb3RlX2hvc3Q9MTAuMC4yLjI=]]></property><property name="PHP_IDE_CONFIG" fullname="$_SERVER['PHP_IDE_CONFIG']" address="139890200404928" type="string" size="21" encoding="base64"><![CDATA[c2VydmVyTmFtZT14ZGVidWcuZGV2]]></property><property name="LOGNAME" fullname="$SERVER['LOGNAME']" address="139890200405112" type="string" size="7" encoding="base64"><![CDATA[dmFncmFudA==]]></property><property name="" fullname="$SERVER['']" address="139890200405296" type="string" size="19" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9iaW4veHBocA==]]></property><property name="XDG_SESSION_ID" fullname="$_SERVER['XDG_SESSION_ID']" address="139890200405472" type="string" size="1" encoding="base64"><![CDATA[Ng==]]></property><property name="TERM" fullname="$_SERVER['TERM']" address="139890200405656" type="string" size="14" encoding="base64"><![CDATA[eHRlcm0tMjU2Y29sb3I=]]></property><property name="PATH" fullname="$_SERVER['PATH']" address="139890200405912" type="string" size="88" encoding="base64"><![CDATA[L3Vzci9sb2NhbC9zYmluOi91c3IvbG9jYWwvYmluOi91c3Ivc2JpbjovdXNyL2Jpbjovc2JpbjovYmluOi91c3IvZ2FtZXM6L3Vzci9sb2NhbC9nYW1lcw==]]></property><property name="XDG_RUNTIME_DIR" fullname="$_SERVER['XDG_RUNTIME_DIR']" address="139890200406088" type="string" size="14" encoding="base64"><![CDATA[L3J1bi91c2VyLzEwMDA=]]></property><property name="LANG" fullname="$_SERVER['LANG']" address="139890200406272" type="string" size="11" encoding="base64"><![CDATA[ZW5fVVMuVVRGLTg=]]></property><property name="LS_COLORS" fullname="$_SERVER['LS_COLORS']" address="139890200408008" type="string" size="1302" encoding="base64"><![CDATA[cnM9MDpkaT0wMTszNDpsbj0wMTszNjptaD0wMDpwaT00MDszMzpzbz0wMTszNTpkbz0wMTszNTpiZD00MDszMzswMTpjZD00MDszMzswMTpvcj00MDszMTswMTpzdT0zNzs0MTpzZz0zMDs0MzpjYT0zMDs0MTp0dz0zMDs0Mjpvdz0zNDs0MjpzdD0zNzs0NDpleD0wMTszMjoqLnRhcj0wMTszMToqLnRnej0wMTszMToqLmFyaj0wMTszMToqLnRhej0wMTszMToqLmx6aD0wMTszMToqLmx6bWE9MDE7MzE6Ki50bHo9MDE7MzE6Ki50eHo9MDE7MzE6Ki56aXA9MDE7MzE6Ki56PTAxOzMxOiouWj0wMTszMToqLmR6PTAxOzMxOiouZ3o9MDE7MzE6Ki5sej0wMTszMToqLnh6PTAxOzMxOiouYnoyPTAxOzMxOiouYno9MDE7MzE6Ki50Yno9MDE7MzE6Ki50YnoyPTAxOzMxOioudHo9MDE7MzE6Ki5kZWI9MDE7MzE6Ki5ycG09MDE7MzE6Ki5qYXI9MDE7MzE6Ki53YXI9MDE7MzE6Ki5lYXI9MDE7MzE6Ki5zYXI9MDE7MzE6Ki5yYXI9MDE7MzE6Ki5hY2U9MDE7MzE6Ki56b289MDE7MzE6Ki5jcGlvPTAxOzMxOiouN3o9MDE7MzE6Ki5yej0wMTszMToqLmpwZz0wMTszNToqLmpwZWc9MDE7MzU6Ki5naWY9MDE7MzU6Ki5ibXA9MDE7MzU6Ki5wYm09MDE7MzU6Ki5wZ209MDE7MzU6Ki5wcG09MDE7MzU6Ki50Z2E9MDE7MzU6Ki54Ym09MDE7MzU6Ki54cG09MDE7MzU6Ki50aWY9MDE7MzU6Ki50aWZmPTAxOzM1OioucG5nPTAxOzM1Oiouc3ZnPTAxOzM1Oiouc3Znej0wMTszNToqLm1uZz0wMTszNToqLnBjeD0wMTszNToqLm1vdj0wMTszNToqLm1wZz0wMTszNToqLm1wZWc9MDE7MzU6Ki5tMnY9MDE7MzU6Ki5ta3Y9MDE7MzU6Ki53ZWJtPTAxOzM1Oioub2dtPTAxOzM1OioubXA0PTAxOzM1OioubTR2PTAxOzM1OioubXA0dj0wMTszNToqLnZvYj0wMTszNToqLnF0PTAxOzM1OioubnV2PTAxOzM1Oioud212PTAxOzM1OiouYXNmPTAxOzM1Oioucm09MDE7MzU6Ki5ybXZiPTAxOzM1OiouZmxjPTAxOzM1OiouYXZpPTAxOzM1OiouZmxpPTAxOzM1OiouZmx2PTAxOzM1OiouZ2w9MDE7MzU6Ki5kbD0wMTszNToqLnhjZj0wMTszNQ==]]></property><property name="SSH_AUTH_SOCK" fullname="$_SERVER['SSH_AUTH_SOCK']" address="139890200408208" type="string" size="31" encoding="base64"><![CDATA[L3RtcC9zc2gtbnBXZ0VLeGVLTS9hZ2VudC4yNTc3MA==]]></property><property name="SHELL" fullname="$_SERVER['SHELL']" address="139890200408392" type="string" size="9" encoding="base64"><![CDATA[L2Jpbi9iYXNo]]></property><property name="LESSCLOSE" fullname="$_SERVER['LESSCLOSE']" address="139890200408576" type="string" size="23" encoding="base64"><![CDATA[L3Vzci9iaW4vbGVzc3BpcGUgJXMgJXM=]]></property><property name="PWD" fullname="$_SERVER['PWD']" address="139890200408760" type="string" size="13" encoding="base64"><![CDATA[L2hvbWUvdmFncmFudA==]]></property><property name="SSH_CONNECTION" fullname="$_SERVER['SSH_CONNECTION']" address="139890200408952" type="string" size="27" encoding="base64"><![CDATA[MTAuMC4yLjIgNjIwODIgMTAuMC4yLjE1IDIy]]></property><property name="PHP_SELF" fullname="$_SERVER['PHP_SELF']" address="139890200409472" type="string" size="21" encoding="base64"><![CDATA[eGRlYnVnLmRldi94ZGVidWcucGhw]]></property><property name="SCRIPT_NAME" fullname="$_SERVER['SCRIPT_NAME']" address="139890200409856" type="string" size="21" encoding="base64"><![CDATA[eGRlYnVnLmRldi94ZGVidWcucGhw]]></property><property name="SCRIPT_FILENAME" fullname="$_SERVER['SCRIPT_FILENAME']" address="139890200410240" type="string" size="21" encoding="base64"><![CDATA[eGRlYnVnLmRldi94ZGVidWcucGhw]]></property><property name="PATH_TRANSLATED" fullname="$_SERVER['PATH_TRANSLATED']" address="139890200410624" type="string" size="21" encoding="base64"><![CDATA[eGRlYnVnLmRldi94ZGVidWcucGhw]]></property><property name="DOCUMENT_ROOT" fullname="$_SERVER['DOCUMENT_ROOT']" address="139890200410960" type="string" size="0" encoding="base64"><![CDATA[]]></property><property name="REQUEST_TIME_FLOAT" fullname="$_SERVER['REQUEST_TIME_FLOAT']" address="139890200411112" type="float"><![CDATA[1455204704.5075]]></property><property name="REQUEST_TIME" fullname="$_SERVER['REQUEST_TIME']" address="139890200411272" type="int"><![CDATA[1455204704]]></property><property name="argv" fullname="$_SERVER['argv']" address="139890200401448" type="array" children="1" numchildren="1"></property><property name="argc" fullname="$_SERVER['argc']" address="139890200401840" type="int"><![CDATA[1]]></property></property></response>

<- context_get -i 15 -d 0 -c 2
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="context_get" transaction_id="15" context="2"></response>

<- property_get -i 16 -n $son->Dadsecrets -d 0 -c 0 -p 0
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug&quot; command="property_get" transaction_id="16" status="stopping" reason="ok"></response>

Log closed at 2016-02-11 15:31:47

derick

2016-02-11 23:00

administrator   ~0003489

I do need to see the code to go with that as well... or is that the code from "Steps to Reproduce"?

aazon

2016-02-11 23:04

reporter   ~0003490

Yes it is exactly that code

aazon

2016-07-13 10:05

reporter   ~0003647

Do I need to report this bug to PhpStorm instead?

derick

2021-03-17 09:26

administrator   ~0005745

Is this issue still relevant to you?

aazon

2021-03-22 09:00

reporter   ~0005816

This issue has been solved for me. Thanks!

derick

2021-11-10 15:44

administrator   ~0006152

Let me close this out then. Thanks :-)

Issue History

Date Modified Username Field Change
2016-01-13 16:18 aazon New Issue
2016-01-19 22:36 derick Note Added: 0003428
2016-01-19 22:36 derick Assigned To => derick
2016-01-19 22:36 derick Status new => feedback
2016-02-08 21:10 derick Note Added: 0003457
2016-02-11 15:33 aazon Note Added: 0003480
2016-02-11 15:33 aazon Status feedback => assigned
2016-02-11 23:00 derick Note Added: 0003489
2016-02-11 23:00 derick Status assigned => feedback
2016-02-11 23:04 aazon Note Added: 0003490
2016-02-11 23:04 aazon Status feedback => assigned
2016-07-13 10:05 aazon Note Added: 0003647
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-12-04 16:05 derick Status assigned => acknowledged
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:37 derick Category Variable Display => Step Debugging
2021-03-17 09:26 derick Status acknowledged => feedback
2021-03-17 09:26 derick Note Added: 0005745
2021-03-22 09:00 aazon Note Added: 0005816
2021-03-22 09:00 aazon Status feedback => assigned
2021-11-10 15:44 derick Status assigned => resolved
2021-11-10 15:44 derick Resolution open => no change required
2021-11-10 15:44 derick Note Added: 0006152