微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – Xdebug在访问类静态属性时中断

我的开发环境中有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/*

# 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设置:

[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上设置一个断点;或者进入行,我得到:

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

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

怎么了?

我认为这是XDebug中的一个bug – 请看这些bug报告

> http://bugs.xdebug.org/view.php?id=1185
> https://github.com/docker-library/php/issues/133

同时,您可以通过使用xdebug_break()函数在抛出异常的行之前对其进行排序,并继续调试.抛出异常之后,我尝试在线上设置断点,我发现断点不足以阻止它抛出异常.

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

原文地址:https://www.jb51.cc/php/138516.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐