MyBB Hacks

Full Version: Question about usual debugging techniques for MyBB development
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

At the moment I'm working on a complicated plugin. Basically, whenever anything goes wrong in the PHP code I'm completely blind, and this makes it nigh on impossible to solve the problem.

How can I see what is going on in the code? I've tried the recommended <script>console.log... method but this just causes an encoding error. Also FireBug allows some level of debuggability for JavaScript code files, but doesn't cover the highly nested PHP plugin files. I also found the NetBeans 'debug' feature didn't work right and was just useless.

So how do the developers here 'get eyes into the execution of the code', and debug this stuff?

Cheers!
print_r
var_dump

Debuggers exist (XDebug), but I suspect most people just dump the output of variables.
Cheers,
I ended up getting a debugging regime working, I'll post it here for reference:

1) Have a local server. For windows, I have EasyPHP DevServer.
2) Make sure it has XDebug installed. I updated my XDebug on my local server to the latest version as follows:
a) On your local server, make a php file which calls phpinfo(), then open that file in browser.
b) copy and paste that output to http://xdebug.org/wizard.php
c) follow that wizard's instructions
3) Get the latest Netbeans IDE, and install the plugin called "PHP".
4) In Tools > Options > PHP > Debugging, unselect 'Stop at First Line'. If you don't, especially when you're trying to debug something as big as MyBB, it will trigger an invisible breakpoint at the first line of every single php file.
5) Create a New Project in NetBeans, Category:PHP > PHP application with Existing Source
6) Place breakpoints as needed.
7) Click Debug > Debug Project (or CTRL+F5)
8) Profit
Reference URL's