my inventions] is an intuition, and comes with a burst, then difficulties arise – this thing gives out and [it is] then that ‘Bugs’ – as such little faults and difficulties are called – show themselves […].“ Thomas Edison, 1878
Laboratory • Operators traced an error in the Mark II to a moth trapped in a relay, coining the term bug. • This bug was carefully removed and taped to the log book. • source: Wikipedia
of a PHP-Guy. Once in awhile I hang out on IRC or work on a project with Werner and he says "!debug lerni", then the IRC-bot says… lerni: Maybe it's time to start xdebug and see what’s going on... check out http://docs.silverstripe.org/en/developer_guides/debugging/ and http://xdebug.org/docs/
mode, enabling debugging messages to the browser on a live server. For security, you'll be asked to log in with an administrator log-in. Will persist for the current browser session. • ?isTest=1 See above. • ?debug=1 Show a collection of debugging information about the director / controller operation • ?debug_request=1 Show all steps of the request from initial HTTPRequest to Controller to Template Rendering
executed • ?showtemplate=1 Show the compiled version of all the templates used, including line numbers. Good when you have a syntax error in a template. Cannot be used on a Live site without isDev when logged in as Admin. https://docs.silverstripe.org/en/3.4/developer_guides/debugg ing/ https://docs.silverstripe.org/en/3.4/developer_guides/debugg ing/url_variable_tools/
on the bottom of your page • execution time overview. • show messages l($var) to the DebugBar, • trace where queries come from. • ?showqueries=1 and also dump d($obj) look pretty.
“leftovers” in your code • Pause and resume execution • Change the value of a variable while the code is running • Pretty backtrace out of the box • Detect @ in the code
=> go inside a called function or method (F7) Force Step Into => (Shift+Alt+F7 | ⌥⇧F7) Step Out => leave the current function (Shift+F8 | ⇧F8) Run to Cursor => (Alt+F9 | ⌥F9)
PHPStorm has a good documentation for this • How to use sqlite3 while debugging the unit test? • Terribly slow • https://confluence.jetbrains.com/display/PhpStorm/Debuggi ng+PHP+CLI+scripts+with+PhpStorm