Xdebug breaks on access to class static property

后端 未结 2 1084
梦毁少年i
梦毁少年i 2021-02-07 07:42

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 \\ 
                      


        
相关标签:
2条回答
  • 2021-02-07 08:16

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

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

    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.

    Update: The problem has been nailed down to a combination of a specific version of PHP with a specific version of Xdebug and a specific compiler used for some images. A potential solution has been proposed in the docker-library bug report, which involves installing specific versions of these packages, if you're using Docker.

    FROM php:5.6.3-apache
    
    # XDebug
    RUN yes | pecl install xdebug \
        && yes | apt-get update \
        && yes | apt-get install php5-xdebug \
        && echo "zend_extension=/usr/lib/php5/20131226/xdebug.so" > /usr/local/etc/php/conf.d/xdebug.ini \
            && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
          && echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
    
    0 讨论(0)
  • 2021-02-07 08:28

    The error described can only be reproduced in the official PHP5 images. PHP 7 images work just fine, and when building a custom PHP5 FPM image from jessie or ubuntu, the error also does not occur.

    0 讨论(0)
提交回复
热议问题