2014-04-23 63 views
11

我试图调试代码的显示子阵列:phpStorm/Xdebug的不能显示对象

public function removeBlankLines() { 
    $this->qp->find('br'); 
    } // <-- break point is here 

当我深入到$这个对象(使用phpStorm)我看不到。孩子阵列我感兴趣的是它只是显示“无法获取属性”截图:

phpStorm debug pane screenshot

我“听调试连接”功能。我正在从命令行运行脚本。 PHP版本:

[[email protected] ~]$ php -v 
PHP 5.4.24 (cli) (built: Jan 19 2014 21:32:15) 
Copyright (c) 1997-2013 The PHP Group 
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies 
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans 

也许相关:http://bugs.xdebug.org/view.php?id=996

+1

http://youtrack.jetbrains.com/issue/WI-15975。我相信这都是因为SplObjectStorage和类似的(ArrayObject等)在**内部**实现的。这应该是一个xdebug/php问题,而不是PhpStorm的问题。 – LazyOne

+0

感谢LazyOne。所以没有修复/解决方法? –

+1

好吧..看看是否将它添加到“手表”面板会做得更好('$ this-> qp-> matches-> storage')。否则评论/等待对xdebug问题跟踪器的响应。附:你也可以尝试最新的2.2.4 xdebug版本..但是我相信自你2.2.3以来这方面没有任何变化。 – LazyOne

回答

9

http://bugs.xdebug.org/view.php?id=686

这是怎么一回事这样的类(SplObjectStorageArrayObject和相似)实现内部

this is because objects of the class SplObjectStorage are not user land PHP objects but special super duper internal ones. A similar situation will happen with many other internal PHP classes.

据我所知没有任何东西可以在PhpStorm的一边,直到Xdebug的做就能“支持“他们。


UPDATE:上述Xdebug的票证解决的XDebug的2.3.3前一段时间(最新的稳定版本的XDebug 2.4.1是),它应该可以在调试器来查看这些类。

+0

你能确认它实际上与新的Xdebug的版本?我刚安装并启用2.4。1在我的流浪者机器上,但我仍然在尝试查看ArrayObject的存储属性时遇到上述错误。 – Subsurf

+0

@Subsurf请提供一些简单的代码示例,其中包含一些解释/屏幕截图,让您看起来如何。我刚刚在Windows 7上使用PhpStorm 2016.2.1 + PHP 5.6.26(x86 nts)+ xdebug 2.4.0在xdebug bug票证中的代码示例进行了测试,它向我展示了'SplObjectStorage'对象的内部结构 - https:/ /postimg.org/image/kwfwp52sh/ – LazyOne

+0

即使我有Xdebug v2.4.0和PhpStorm 2017.1.3,我仍然收到此错误。 – RaisinBranCrunch

6
  • 升级你的XDebug到2.3.3版本,它如果您正在运行游民确保您在
    游民升级虚拟机的XDebug已经修复了这个问题 http://bugs.xdebug.org/view.php?id=686#c3116
  • 升级说明可以得到形式http://xdebug.org/wizard.php

    如果升级是不是一种选择,你可以转储的内容作为最后
    胜地。

    在计算表达式,你可以尝试这样

    file_put_contents( 'dump.txt',var_export($ requiredVariable,真));

+0

这是一个很好的解决方法,'file_put_contents('dump.txt',var_export($ requiredVariable,true));'谢谢!该文件将在项目根目录中创建。 – john

+0

我建议升级xdebug扩展@john – zainengineer

0

,如果你正试图检查属性是从父类继承,并从目前的范围不可见您还将得到! can not get property错误。

实施例:

的XDebug将注释相关性质等,例如:

$childClass = {path\to\child\Child} 
    *path\to\class\Parent*property = {path\to\property\Property} 

其中:

  • Parent是基类
  • Child是延伸类
  • property是继承属性,对父

注星号*其识别该情况,并且表示“不可见从当前范围”限定。

解决方法:

的快速解决方案,使调试是对父母的属性的可见性设置为public

class Parent { 
    public $property; // instead of private or protected 
} 

class Child extends Parent{ 
    // You can now inspect parent::$property for instances of Child 
} 

记住完成测试时,设置该属性的知名度回到正确的值。

0

Linux LDME2
php5.6.30-0+deb8u1
xdebug v2.5.3

我tryed这个招待。

php -i | xclip -selection clipboard 

投入,并按照说明

https://xdebug.org/wizard.php 

我得到这个结果(无法获得财产

sha256sum ~/xdebug-from-src/xdebug-2.5.3/modules/xdebug.so afbb70941387ff1e191433d2a09ff42a393caac773194c0e9004b844a0f3d73b

我瑶池修复这个问题。相反,从源代码构建,需要从PECL

安装
sudo pecl install xdebug 

sha256sum /usr/lib/php5/20131226/xdebug.so b82f2a4ab101323d3600a79223143e2eefe941d404c88af2bd7434fd47caaf13

php -v 

PHP 5.6.30-0+deb8u1 (cli) (built: Feb 8 2017 08:50:21) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.5.3, Copyright (c) 2002-2017, by Derick Rethans