Xdebug在访问类静态属性时中断 [英] Xdebug breaks on access to class static property

查看:200
本文介绍了Xdebug在访问类静态属性时中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  FROM library / php:5.5-apache 

RUN apt-get -qqy update&& apt-get -qqy install \
libpq-dev \
libmcrypt-dev \
libxml2-dev \
ssl-cert \
vim \\ \\
git \
mc \
&&& rm -r / var / lib / apt / lists / *

#编译并添加xdebug
运行pecl安装xdebug \
&& echozend_extension = xdebug.so>>> /usr/local/etc/php/conf.d/xdebug.ini

#configure apache和vhosts
RUN a2enmod rewrite ssl \
&&& a2ensite 000-default default-ssl

ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR / var / log / apache2
ENV APACHE_RUN_DIR / var /运行/ apache2
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
ENV APACHE_LOCK_DIR / var / lock / apache2

CMD [apache2-foreground]

Xdebug设置:

  [xdebug] 
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_host = 172.17.42.1
xdebug.remote_port = 9000

一切都很好,但有一件事。调试代码时:

 <?php 
class A {
static private $ a;

static public function init(){
self :: $ a = 123;
}
}

A :: init();

如果我在 self = $ a = 123; / code>或进入行,我得到:

 致命错误:访问未声明的静态属性:A: :$ a 

如果我不进入该行,调试会话继续没有任何问题。



有什么问题?

解决方案

我认为这是一个bug XDebug - 看到这些错误报告





同时,您可以通过使用投掷线之前的 xdebug_break()函数来排序问题的工作异常并从那里继续调试。我尝试在抛出异常后在线上设置断点,我发现断点不足以阻止它抛出异常。



不是一个完美的解决方案,希望这些错误很快就会被修正


I've a problem with Xdebug in my development environment.

FROM library/php:5.5-apache

RUN apt-get -qqy update && apt-get -qqy install \ 
               libpq-dev \
               libmcrypt-dev \
               libxml2-dev \
               ssl-cert \
               vim \
               git \
               mc \
        && rm -r /var/lib/apt/lists/*

# compile and add xdebug
RUN pecl install xdebug \
    && echo "zend_extension=xdebug.so" >> "/usr/local/etc/php/conf.d/xdebug.ini"

# configure apache and vhosts
RUN a2enmod rewrite ssl \
        && a2ensite 000-default default-ssl

ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
ENV APACHE_LOCK_DIR /var/lock/apache2

CMD ["apache2-foreground"]

Xdebug settings:

[xdebug]
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_host=172.17.42.1
xdebug.remote_port=9000

Everything works good but one thing. When debugging the code:

<?php
class A {
    static private $a;

    static public function init() {
        self::$a = 123;
    }
}

A::init();

If I set a breakpoint on self::$a = 123; or step into the line, I get:

Fatal error: Access to undeclared static property: A::$a

If I don't step into that line, the debugging session continues without any problems.

What's wrong?

解决方案

I think it's a bug somewhere in XDebug - see these bug reports

Meanwhile you may be able to sort of work around the issue by using the xdebug_break() function just AFTER the line that's throwing the exception and continue debugging from there. I tried setting a breakpoint on the line after the exception is thrown and I found that a breakpoint wasn't enough to stop it throwing an exception.

Not a perfect solution but hopefully those bugs will get fixed soon

这篇关于Xdebug在访问类静态属性时中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆