Jump to content

PW 3 & Xdebug funkiness?

Recommended Posts

Hi there,

Just started with PW3 and building out my site. I used PHPStorm & XDebug just fine with PW2.7.

If I run my PW3 site without any debugging turned on, the (very) basic homepage renders fine. If I turn on Xdebug and set a breakpoint or two, all is fine until I get into PriocessWire::buildConfig() at the line that news up a Config() instance ) line #604.

$config = new Config();

When I step through that line or execute it in the console, the system acts as though it can't find the Config class.

In my php error log file, I get entries like:

[13-Mar-2016 21:34:54 Europe/Berlin] PHP Fatal error:  Class 'ProcessWire\WireDebugInfo' not found in /Applications/MAMP/htdocs/hsa/ProcessWire/wire/core/Wire.php on line 1174
[13-Mar-2016 21:34:54 Europe/Berlin] PHP Stack trace:
[13-Mar-2016 21:34:54 Europe/Berlin] PHP   1. {main}() /Applications/MAMP/htdocs/hsa/ProcessWire/index.php:0
[13-Mar-2016 21:34:54 Europe/Berlin] PHP   2. ProcessWire\ProcessWire::buildConfig($rootPath = *uninitialized*, $rootURL = *uninitialized*) /Applications/MAMP/htdocs/hsa/ProcessWire/index.php:33
[13-Mar-2016 21:34:54 Europe/Berlin] PHP   3. ProcessWire\WireData->__debugInfo() /Applications/MAMP/htdocs/hsa/ProcessWire/index.php:605[13-Mar-2016 21:34:54 Europe/Berlin] PHP   4. ProcessWire\Wire->__debugInfo() /Applications/MAMP/htdocs/hsa/ProcessWire/wire/core/WireData.php:415 

It's all a bit weird. It runs without the Xdebug listening for breakpoints but turn Xdebug on and it all goes pearshaped!

Any ideas/thoughts/suggestions very welcome.

Cheers! :)

Share this post

Link to post
Share on other sites

Problem originates from the use of __debugInfo() magic method that comes with v5.6.

Try using PHP 5.5. Processwire + xDebug doesn't play well with PHP >= v5.6.

  • Like 4

Share this post

Link to post
Share on other sites

Hi @adbus - many thanks for the heads-up. I googled around and it seems that there was some kind of xdebug issue with __debugInfo() that was fixed in 2014 and there seem to be others recorded quite recently that haven't been fixed as yet.

I don't want to go backwards with respect to PHP version so, I'll just have to put up with whatever issues arise on the odd occasions that they do.

Again, I really appreciate you taking the time to point this out! :)

  • Like 1

Share this post

Link to post
Share on other sites

I use PHP5.5 on my local dev environment, but 7.0 on production. It's a small sacrifice for the convenience of using step-by-step debugger instead of echo and var_dump(). It sucks that PW doesn't work well, but until it gets fixed, I'll have to settle for v5.5.

  • Like 1

Share this post

Link to post
Share on other sites

I use MAMP locally and the non-Pro version offers 5.6 and 7.00 only. You make a good point about the small trade-off. It's definitely worth considering!

Share this post

Link to post
Share on other sites

I use Wamp at the moment. I added php 5.5.36 to my set up today.  I had added php 7 in April. I now have 3 versions of php in my setup lol. :)

I found this write up to be helpful How to Upgrade PHP in WAMP

Xdebug definitely seems to be OK on 5.5 as has been said. I can only speak for Visual Studio Code and Netbeans, though.

I am going to post the php.ini settings I used for 5.5. It might save someone a little time. I am using the thread safe version, 64 bit. With Windows it seems that I needed a version of php that came with the php5apache2_4.dll. The non-thread safe version did not include it in the zip. 

OH, and when you're updating php.ini on Wamp, remember to also save it as phpForApache.ini !! :D  It's mentioned in the article I provided the link to.


; XDEBUG Extension

zend_extension = "c:/wamp64/bin/php/php5.5.36/zend_ext/php_xdebug-2.4.0-5.5-vc11-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp64/tmp"

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...