How x debug restored partial sanity to the insane

481 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
481
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • There was echo and print And it was good
  • Then came print_r & var_dumpAnd it was good
  • Then a horrible evil came upon the world..
  • Magento forces MVC and EAV. Configuration is a mix between DB, config files and code. Objects use magic methods __get __call __set etc.Lazy Loading and CachingPoor documentation on the set up.Oh yea the singletons, collections and helpers make a fine mess when trying to do something.
  • I was going to paste in a full print_r or var_dump of one of the objectsBut one of the simplest objects took about 20 slides So as you can see usingprint_r and var_dump will be troublesome since you have to send all this data over http to the browser to look at it.
  • What was I to do?How can I go on and make changes in Magento ?How the hell did others make wonderful extensions and plugins ?
  • xDebug provided the solutionYou can set break pointsget stack tracesview data and objects as they are being instantiated
  • Now I was able to get to work coding and making the boss happy which made me happy
  • Gotohttp://www.xdebug.org/find-binary.phpPaste in the output of : php -iDownload the binary suggestedInstall the binary as a zend_extensionMake sure you have a php.iniDerickRethans offers a suggestion on the page as wellphp –i >> info.txtremote_enable: Starts a remote session when flag calledremote_host: sets the host name remote_port: 9000 by default change for firewallremote_handler: dbgp (debugging protocol)
  • Eclipse is a little more complicated Before you start: Make sure all files your code can touch is located in projects or is referenced in the include pathsNote: Break at 1st line needs eclipse to restart to take effect
  • Use Multi session to on Accept Remote Session JIT (Just In Time)
  • Just Double click on the line you want to break You can also right click and select toggle break pointOpen the browser Pass in XDEBUG_SESSION_START=true in the URL (Switch to eclipse )
  • Debug Tab: Controls stepping and displays current stack traceF5 – StepF6 – Step over (skips over a function call)F7 – Step Return When in a function will continue to the return statementF8 – Resume to next breakpointPHP stores the stack in strange ways (too much to explain in class) which is why you will see the stack as a tree
  • Variables Tab, Lists all variables, the current state and there value (Cannot change values of variables here)
  • Breakpoints TabAllow you to toggle breakpoints on and off Can set the condition for the variable to allow you to change values Step filters are not implemented
  • Improved Error Out putting
  • Profiling (cache grind)
  • Code Coverage (PHP Unit)
  • Thanks!!!
  • How x debug restored partial sanity to the insane

    1. 1. How XDebugrestored partial sanity to the insane world of PHP<br />
    2. 2. In the beginning …….<br />Echo<br />Print<br />
    3. 3. In the beginning …….<br />var_dump<br />print_r<br />
    4. 4.
    5. 5. In the beginning …….<br />
    6. 6. In the beginning …….<br />
    7. 7. In the beginning …….<br />
    8. 8. In the beginning …….<br />
    9. 9. In the beginning …….<br />
    10. 10. In the beginning …….<br />
    11. 11. Installation and Setup<br />http://www.xdebug.org/find-binary.php<br />
    12. 12. Installation and Setup<br />
    13. 13. Installation and Setup<br />
    14. 14. How to use break points<br />XDEBUG_SESSION_START=true<br />
    15. 15. Navigation Debug Mode<br />
    16. 16. Navigation Debug Mode<br />
    17. 17. Navigation Debug Mode<br />
    18. 18. Features<br />
    19. 19. Features<br />
    20. 20. Features<br />
    21. 21. Thank You<br />References: <br />http://www.xdebug.org<br />http://www.eclipse.org<br />Images:<br />xDebug Logo: http://www.xdebug.org/images/xdebug-logo.png<br />Eclipse Logo: http://www.eclipse.org<br />PHP Logo: http://www.php.net<br />Print Icon: http://icons.iconarchive.com/icons/mart/glaze/128/printer-1-icon.png<br />Sound Wave: http://docstore.mik.ua/orelly/web2/audio/figs/aud.0210.g<br />

    ×