2015-09-14 80 views
14

我在开发环境中遇到了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 

如果我不踏入这行,调试会话继续无任何问题。

怎么了?

+0

与Xdebug v2.3.2 PHP 5.4.43相同的问题。 通过docker自己构建。 – shark555

+0

我使用了不同的xdebug版本,不同的调试客户端。我已经通过pecl安装了xdebug并自己编译。问题必须在官方码头里的某个地方php image –

+0

你在用什么IDE? – bishop

回答

1

我认为这是一个错误的地方在XDebug的 - 看到这些错误报告

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

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

0

描述只能在官方PHP5图像进行复制的错误修复。 PHP 7的图像工作得很好,当从jessie或ubuntu构建定制的PHP5 FPM图像时,错误也不会发生。