Unusual behaviour debugging Joomla Box with PhpStorm

38 views
Skip to first unread message

Chris Bradbury

unread,
Nov 11, 2016, 5:47:09 AM11/11/16
to Joomlatools Developers
Just tried remote debugging a project on a Joomla Box in PhpStorm and it's pretty erratic.

I'm debugging a save() method in a controller. Some breakpoints are missed entirely when they should be hit, and the ones that are being hit will often step through incorrectly. As an example:

$app->setUserState('foo', 'foo');

$validData['modified'] = JFactory::getDate()->toSql();

A breakpoint at the setUserState method will immediately step through to getDate(), not setUserState(). Add another setUserState above it and the breakpoint is missed entirely.

Other breakpoints seem to be offset by a line - for example a breakpoint at the return statement will be skipped, but a breakpoint at the closing curly braces won't be.

Meanwhile everything's working fine on my XAMPP and Debian installs.

Joomla Box install is mostly clean - I disabled Z-Ray due to the conflict with phpMyAdmin.

I also disabled Varnish thinking the problems may be due to caching. At least I think I disabled it - despite getting "Varnish is already disabled!" in the terminal I'm still getting an "Error 503 Backend fetch failed" message from the Varnish cache server if I leave the debugger paused for a while. So I'm thinking my problems may still be related to caching somehow and I might not have turned Varnish off properly.

Any advice would be appreciated.

Steven Rombauts

unread,
Nov 11, 2016, 6:26:49 AM11/11/16
to Joomlatools Developers
Hi Chris,

I'm not sure how to explain the erratic debugging behaviour, if PhpStorm can talk to Xdebug it should work fine. If it seems to be breaking at the wrong files/lines, the only reason I can come up with is that the path mapping might be incorrect. Are you using the default PHP version?

To explain the Varnish issues: even if Varnish is disabled, it is still sitting between you and Apache. It's only bypassing the cache mechanisms when disabled. We are seeing a few issues with this approach in certain situations and are looking at a fix for the next release. To make sure Varnish is not in the way, it's best to connect to joomla.box:8080 directly.

The only reason I can think of why Varnish would be giving 503 errors when debugging is because of a timeout, as it's waiting on PHP to return a response. 

Cheers,
Steven

--

---
You received this message because you are subscribed to the Google Groups "Joomlatools Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomlatools-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Bradbury

unread,
Nov 11, 2016, 8:31:40 AM11/11/16
to joomlat...@googlegroups.com
Cheers for the reply.

Just found the problem - I've evidently set something up incorrectly somewhere along the line.

Edited files are being 'deployed' to the 'www' folder in the local vagrant install folder, but they aren't getting pushed to the actual box. The discrepancy between the remote and local copies was responsible for the breakpoint weirdness.

Should be easy fixed.

--

---
You received this message because you are subscribed to a topic in the Google Groups "Joomlatools Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/joomlatools-dev/lAXP9iLQibU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to joomlatools-dev+unsubscribe@googlegroups.com.

Steven Rombauts

unread,
Nov 11, 2016, 8:40:24 AM11/11/16
to Joomlatools Developers
Hi Chris,

Good to hear you found the solution. Do you mean that you are editing files in one location, and have a listener that is copying edited files into the Joomla site at the www directory on each change?

If that is the case, I would recommend mounting your source directory and using symlinks to link the files into the Joomla install.

Happy coding!

Cheers,
Steven

Chris Bradbury

unread,
Nov 11, 2016, 12:36:04 PM11/11/16
to joomlat...@googlegroups.com
I have no idea what the problem was.

Yes, I'm modifying files in the shared Projects folder and having them copied into the shared www folder. It seems that for some reason the local www folder wasn't syncing properly with the VM.

I deleted everything and reinstalled the box and now it's working as it should. As a bonus, Z-Ray seems to be working this time around too.

Thanks again for the help.
Reply all
Reply to author
Forward
0 new messages