Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Stop using var_dump(); Embrace step debugging
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
BoldMinded
October 09, 2017
Programming
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Stop using var_dump(); Embrace step debugging
EE CONF 2017 Presentation
BoldMinded
October 09, 2017
More Decks by BoldMinded
See All by BoldMinded
A/B Testing
boldminded
0
170
Using Behat to test ExpressionEngine add-ons
boldminded
0
33
The Anatomy of a 5000 hour project
boldminded
4
850
Other Decks in Programming
See All in Programming
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
120
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
280
Building a Meta Ray-Ban display app
akkeylab
0
170
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
260
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
530
不幸な GC
chencmd
0
400
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
250
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
1
710
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
120
How I Won Prize Money at a Hackathon Using Codex and Symphony Alpha
yasei_no_otoko
0
120
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
1.1k
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
680
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.1k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
340
The SEO identity crisis: Don't let AI make you average
varn
0
530
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
300
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
270
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
440
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
We Have a Design System, Now What?
morganepeng
55
8.3k
Transcript
1
Stop using var_dump(); embrace step debugging 2
Step debugging is stopping code execution on a specific line
of code, then advancing the application 1 line of code at a time. 3
{exp:channel:entries channel="foo" var_dump="yes" } {entry_id} {/exp:channel:entries} 4
{exp:channel:entries channel="foo"} ={title}={entry_id}={some_custom_field}= {/exp:channel:entries} 5
{exp:channel:entries channel="foo"} <pre>{entry_id}</pre> {/exp:channel:entries} 6
var_dump(); 7
var_dump($entry); die; object(BoldMinded\Publisher\Service\Entry\Entry) private 'request' => object(BoldMinded\Publisher\Service\Request) private 'siteId' =>
int 1 private 'entryId' => null private 'defaultLanguage' => object(BoldMinded\Publisher\Model\Language) protected 'id' => int 1 protected 'short_name' => string 'en' (length=2) protected 'short_name_segment' => string 'en' (length=2) protected 'long_name' => string 'English' (length=7) protected 'locale' => string 'en_EN' (length=5) protected 'language_pack' => string 'english' (length=7) protected 'cat_url_indicator' => string 'category' (length=8) protected 'is_default' => string 'y' (length=1) protected 'is_enabled' => string 'y' (length=1) protected 'direction' => string 'ltr' (length=3) protected 'sites' => string '[1]' (length=3) protected '_name' => string 'publisher:Language' (length=18) 8
Pros — Easy — No special tools necessary — Works
anywhere 9
Cons — Slow — Lacks context 10
Alternative function writeToFile($fileName, $data) { $file = PATH_CACHE.$fileName.'.txt'; $stream =
fopen($file, 'a+'); fwrite($stream, print_r($data, TRUE) ."\n"); fclose($stream); } 11
Xdebug is a PHP extension which provides debugging and profiling
capabilities. 12
13
14
Installing and Configuring apt-get install php-xdebug vim /etc/php/apache2/php.ini zend_extension=xdebug.so xdebug.remote_connect_back=1
xdebug.remote_autostart=0 xdebug.remote_enable=1 xdebug.show_exception_trace=1 15
16
Tools — PhpStorm — SublimeText w/ plugin ¯\_(ϑ)_/¯ — Microsoft
Code w/ plugin 17
Navigating — Setting breakpoints 18
Navigating — Conditional breakpoints 19
Navigating — Stepping over 20
Navigating — Stepping into 21
22
23
24
25
Tools — https://www.jetbrains.com/phpstorm/marklets/ — Xdebug Helper in Chrome Store —
?XDEBUG_SESSION_START=PHPSTORM 26
27
28
Demo <blink>Click Here!</blink> 29
Useful breakpoint locations in EE — system/ee/legacy/libraries/Core.php function generate_page() —
system/ee/EllisLab/Addons/channel/mod.channel.php function entries() — system/ee/legacy/libraries/Template.php function run_template_engine() 30
Personal favorites — Call stack while debugging — Easier to
debug loops — Can see EE template code at different parse states 31
32
Remote step debugging zend_extension=xdebug.so xdebug.remote_connect_back=0 xdebug.remote_autostart=0 xdebug.remote_enable=1 33
34
35
36
Demo 37
Hark, there be dragons. 38
Truth You will inevitably lose productivity getting step debug working.
39
But You will gain that time back 10 fold when
you're debugging. I promise. 40
Tips Using repeatable scripts to configure environments will make things
easier. — Ansible — PuPHPet — Docker 41
42
Questions? 43
Thank You! — @litzinger — @boldminded — boldminded.com 44