SlideShare a Scribd company logo
Debugging with
Drupal
The art of
Debugging
Anoop John, CTO
Vimal Joseph, Technical Architect
The Art of Debugging
Bugs everywhere...
SA-CORE-2014-005
The Art of Debugging
Bug-free Software?
The Art of Debugging
Debugging
It's hard enough to find an error in your code when
you're looking for it; it's even harder when you've
assumed your code is error-free.
Steve McConnel
The Art of Debugging
Story Time
Tell us a story on your debugging experience
The Art of Debugging
Set up Debugging Environment
PHP configuration (php.ini)
display_errors = On
log_errors = On
error_reporting = E_ALL | E_STRICT
Drupal modules
Devel
A good editor
Geany
Emacs is better – but learning curve is bit steep.
Learn to setup a development environment for a
given project quickly. Drush will help.
The Art of Debugging
Debugging Tools - PHP
Basic PHP
print/echo
print_r()
exit()/die()
debug_backtrace()/debug_print_backtrace()
The Art of Debugging
Debugging Tools - Drupal
drupal_set_message()
watchdog()
Views
views_trace()
Devel
dpm()
dargs()
dd()
ddebug_backtrace()
db_queryd()
The Art of Debugging
Debugging Tools - HTML, JS,
CSS
Firebug
Web Developer Toolbar
Javascript debugger
The Art of Debugging
Debugging Tools - CLI
Drush – a life saver.
archive-dump, archive-restore, vget, vset, php-
eval, sql-cli, sql-query, user-login etc..
Xdebug
cat, grep, awk, cut
The Art of Debugging
General Approach for
Debugging
Understand the symptom
Understand the context
Define problem statement
Replicate bug
Read through code
Isolate location in code causing bug
Understand code
Understand data / context
Understand cause
Identify solution
Fix bug
The Art of Debugging
Tips for Debugging Code
Trial and error may work – but do not rely on that
Binary search is the best method to isolate a bug
Learn to navigate through code
Learn to read logs
Webserver Access/Error logs
Database Error logs
Drupal error logs
Be familiar with the shell commands
cat, zcat, grep, less etc..
The Art of Debugging
Errors, Notices, Warnings
Warning: htmlspecialchars() expects
parameter 1 to be string, array given in
check_plain() (line 1566 of
/var/www/d7/includes/bootstrap.inc).
Invalid argument supplied for foreach()
in /var/www/d7/includes/common.inc on
line 1919.
Illegal offset type in isset or empty in
/home/pgil1/public_html/modules/taxon
omy/taxonomy.module on line 1090.
The Art of Debugging
Backtrace – your guide
views_trace
debug_backtrace
debug_print_backtrace
ddebug_backtrace
The Art of Debugging
Tips for Debugging Code
// function drupal_set_message() bootstrap.inc
if ($type == 'error') {
// here are some alternatives – views_trace()
// is part of views module
// $message .= '<pre>' . print_r(debug_backtrace(),
TRUE) . '</pre>';
// $message .= '<pre>' . views_trace() . '</pre>';
}
// Or in function watchdog() bootstrap.inc
if ($type == 'php') {
$message .= '<pre>'. print_r(debug_backtrace(),
1) .'</pre>';
//$message .= '<pre>'. views_trace() .'</pre>';
}
// Or in the function which error occurred
ddebug_backtrace(); or dpm() or print_r() //make sure
to add the necessary conditions so that the debug
The Art of Debugging
Tips for Debugging Code
// Debuging cron
// module_invoke() module.inc
if ($hook == 'cron') {
watchdog('debugging', "CRON: Calling
$module");
}
// Errors like “Cannot use object of type
stdClass as array”
// Insert right before the moment of disaster
if (!is_array($x)) {
dpm(ddebug_backtrace(TRUE));
}
The Art of Debugging
Tips for Debugging HTML, CSS,
JS
Inspect using Firebug
Create test HTML
Set custom properties
Walk through JS code execution
Inspect variables
Zyxware Technologies and Drupal
Zyxware is a leading contributor to Drupal from India and is one of only
six Featured Service Providers from India listed on drupal.org
● Over 40,000 websites use our modules and themes
● More than 30 contributed modules and themes
● Maintainer of Search404, a top 100 Drupal module
● Over 1000 commits at drupal.org
● Contributes all patches back to Drupal
● Our profile on drupal.org - http://drupal.org/user/222163
● Knowledge partnerships with Acquia, New Relic and Volacci
● Freedom Walk, a 44 day walk by a team of
Free Software Evangelists across the length of
Kerala to promote Free Software
● Building RithuOS, an Operating System for Engineering
students with Free Software Engineering applications
● GNU/Linux Install Fests in Schools, Colleges and at Technopark.
● Local language (Malayalam) computing camps in colleges
● Building and Maintenance of Freedom Toaster, a Free Software
kiosk
● Conducting Free Software workshops and
lectures in colleges in Kerala
Free Software and Zyxware Technologies
• Check us out at http://www.zyxware.com
• Mail us at drupal@zyxware.com
• Like us at http://www.facebook.com/zyxware
• Follow us at http://www.twitter.com/zyxware
• Connect with us at
http://www.linkedin.com/companies/zyxware-technologies
• Talk to us at +91-9495969446 between 9AM - 9PM IST
• Skype me at aj_zyxware
Contact Us
The Art of Debugging
Thank you …
The Art of Debugging
Credits
http://randyfay.com/content/debugging-techniques
http://www.lullabot.com/articles/quick_and_dirty_de
bugging
Ad

Recommended

Drupal debugging tips
Drupal debugging tips
Adolfo Nasol
 
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Zyxware Technologies
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
DrupalCampDN
 
Drupal development
Drupal development
Dennis Povshedny
 
Build your own PHP extension
Build your own PHP extension
Võ Duy Tuấn
 
DrupalCampLA 2011: Drupal backend-performance
DrupalCampLA 2011: Drupal backend-performance
Ashok Modi
 
Drupal Backend Performance and Scalability
Drupal Backend Performance and Scalability
Ashok Modi
 
Heavy Web Optimization: Backend
Heavy Web Optimization: Backend
Võ Duy Tuấn
 
Drupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal Concepts
Micky Metts
 
Cms drupal installation & configuration anil mishra
Cms drupal installation & configuration anil mishra
Anil Mishra
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
Ashok Modi
 
Drupal development environment
Drupal development environment
Rachit Gupta
 
Drupal performance optimization Best Practices
Drupal performance optimization Best Practices
Ratnesh kumar, CSM
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Mir Nazim
 
Drupal Installation &amp; Configuration
Drupal Installation &amp; Configuration
Anil Mishra
 
04 web optimization
04 web optimization
Nguyen Duc Phu
 
Drupal 6 Performance Tips
Drupal 6 Performance Tips
Trevor James
 
Speeding Up The Snail
Speeding Up The Snail
Marcus Deglos
 
How to reduce database load using Memcache
How to reduce database load using Memcache
valuebound
 
Django Documentation
Django Documentation
Ying wei (Joe) Chou
 
Web profiler in drupal 8
Web profiler in drupal 8
valuebound
 
PHP Summer Training Presentation
PHP Summer Training Presentation
Nitesh Sharma
 
Implementing High Performance Drupal Sites
Implementing High Performance Drupal Sites
Shri Kumar
 
WordPress Structure and Best Practices
WordPress Structure and Best Practices
markparolisi
 
Learn How To Develop With CakePHP
Learn How To Develop With CakePHP
Michael Bourque
 
Practical catalyst
Practical catalyst
dwm042
 
Performance Optimization in Drupal 8
Performance Optimization in Drupal 8
valuebound
 
Drupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappers
Marcus Deglos
 
Phalcon - самый быстрый PHP Framework
Phalcon - самый быстрый PHP Framework
Oleksandr Torosh
 
Drupal 8 и хостинг
Drupal 8 и хостинг
DrupalSPB
 

More Related Content

What's hot (20)

Drupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal Concepts
Micky Metts
 
Cms drupal installation & configuration anil mishra
Cms drupal installation & configuration anil mishra
Anil Mishra
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
Ashok Modi
 
Drupal development environment
Drupal development environment
Rachit Gupta
 
Drupal performance optimization Best Practices
Drupal performance optimization Best Practices
Ratnesh kumar, CSM
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Mir Nazim
 
Drupal Installation &amp; Configuration
Drupal Installation &amp; Configuration
Anil Mishra
 
04 web optimization
04 web optimization
Nguyen Duc Phu
 
Drupal 6 Performance Tips
Drupal 6 Performance Tips
Trevor James
 
Speeding Up The Snail
Speeding Up The Snail
Marcus Deglos
 
How to reduce database load using Memcache
How to reduce database load using Memcache
valuebound
 
Django Documentation
Django Documentation
Ying wei (Joe) Chou
 
Web profiler in drupal 8
Web profiler in drupal 8
valuebound
 
PHP Summer Training Presentation
PHP Summer Training Presentation
Nitesh Sharma
 
Implementing High Performance Drupal Sites
Implementing High Performance Drupal Sites
Shri Kumar
 
WordPress Structure and Best Practices
WordPress Structure and Best Practices
markparolisi
 
Learn How To Develop With CakePHP
Learn How To Develop With CakePHP
Michael Bourque
 
Practical catalyst
Practical catalyst
dwm042
 
Performance Optimization in Drupal 8
Performance Optimization in Drupal 8
valuebound
 
Drupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappers
Marcus Deglos
 
Drupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal Concepts
Micky Metts
 
Cms drupal installation & configuration anil mishra
Cms drupal installation & configuration anil mishra
Anil Mishra
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
Ashok Modi
 
Drupal development environment
Drupal development environment
Rachit Gupta
 
Drupal performance optimization Best Practices
Drupal performance optimization Best Practices
Ratnesh kumar, CSM
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Mir Nazim
 
Drupal Installation &amp; Configuration
Drupal Installation &amp; Configuration
Anil Mishra
 
Drupal 6 Performance Tips
Drupal 6 Performance Tips
Trevor James
 
Speeding Up The Snail
Speeding Up The Snail
Marcus Deglos
 
How to reduce database load using Memcache
How to reduce database load using Memcache
valuebound
 
Web profiler in drupal 8
Web profiler in drupal 8
valuebound
 
PHP Summer Training Presentation
PHP Summer Training Presentation
Nitesh Sharma
 
Implementing High Performance Drupal Sites
Implementing High Performance Drupal Sites
Shri Kumar
 
WordPress Structure and Best Practices
WordPress Structure and Best Practices
markparolisi
 
Learn How To Develop With CakePHP
Learn How To Develop With CakePHP
Michael Bourque
 
Practical catalyst
Practical catalyst
dwm042
 
Performance Optimization in Drupal 8
Performance Optimization in Drupal 8
valuebound
 
Drupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappers
Marcus Deglos
 

Viewers also liked (6)

Phalcon - самый быстрый PHP Framework
Phalcon - самый быстрый PHP Framework
Oleksandr Torosh
 
Drupal 8 и хостинг
Drupal 8 и хостинг
DrupalSPB
 
Debugging in PHP
Debugging in PHP
Micah Wood
 
Если не Drupal 8, то что? Обзор Laravel 5
Если не Drupal 8, то что? Обзор Laravel 5
DrupalSPB
 
Headless Drupal на примере Drupal 8 и React
Headless Drupal на примере Drupal 8 и React
DrupalSPB
 
Why I Hate Drupal
Why I Hate Drupal
James Walker
 
Phalcon - самый быстрый PHP Framework
Phalcon - самый быстрый PHP Framework
Oleksandr Torosh
 
Drupal 8 и хостинг
Drupal 8 и хостинг
DrupalSPB
 
Debugging in PHP
Debugging in PHP
Micah Wood
 
Если не Drupal 8, то что? Обзор Laravel 5
Если не Drupal 8, то что? Обзор Laravel 5
DrupalSPB
 
Headless Drupal на примере Drupal 8 и React
Headless Drupal на примере Drupal 8 и React
DrupalSPB
 
Ad

Similar to Debugging Drupal - How to Debug your Drupal Application (20)

Modernize Your Drupal Development
Modernize Your Drupal Development
Chris Tankersley
 
Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)
Acquia
 
Debugging Drupal with Xdebug
Debugging Drupal with Xdebug
Frank Carey
 
Debugging With Php
Debugging With Php
Automatem Ltd
 
Open Source CMS Certification
Open Source CMS Certification
Vskills
 
Debugging Effectively - SymfonyLive San Francisco 2015
Debugging Effectively - SymfonyLive San Francisco 2015
Colin O'Dell
 
Xdebug
Xdebug
Bryce Embry
 
Сontinuous Integration - step to continuous deployment
Сontinuous Integration - step to continuous deployment
Игорь Родионов
 
Debugging Effectively
Debugging Effectively
Colin O'Dell
 
Contributing to Drupal
Contributing to Drupal
Chris Skene
 
DDD (Debugger Driven Development)
DDD (Debugger Driven Development)
Carlos Granados
 
Why Drupal is Rockstar?
Why Drupal is Rockstar?
Gerald Villorente
 
Debugging PHP with xDebug inside of Eclipse PDT 2.1
Debugging PHP with xDebug inside of Eclipse PDT 2.1
Bastian Feder
 
Debugging Effectively - php[world] 2015
Debugging Effectively - php[world] 2015
Colin O'Dell
 
Debugging PHP with Xdebug - PHPUK 2018
Debugging PHP with Xdebug - PHPUK 2018
Mark Niebergall
 
Drupal Auckland Meetup; Debug like a pro
Drupal Auckland Meetup; Debug like a pro
Gareth Hall
 
Debugging PHP With Xdebug
Debugging PHP With Xdebug
Mark Niebergall
 
Debugging Effectively - Frederick Web Tech 9/6/16
Debugging Effectively - Frederick Web Tech 9/6/16
Colin O'Dell
 
Voiture tech talk
Voiture tech talk
Hoppinger
 
Debugging Effectively - ConFoo Montreal 2019
Debugging Effectively - ConFoo Montreal 2019
Colin O'Dell
 
Modernize Your Drupal Development
Modernize Your Drupal Development
Chris Tankersley
 
Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)
Acquia
 
Debugging Drupal with Xdebug
Debugging Drupal with Xdebug
Frank Carey
 
Open Source CMS Certification
Open Source CMS Certification
Vskills
 
Debugging Effectively - SymfonyLive San Francisco 2015
Debugging Effectively - SymfonyLive San Francisco 2015
Colin O'Dell
 
Сontinuous Integration - step to continuous deployment
Сontinuous Integration - step to continuous deployment
Игорь Родионов
 
Debugging Effectively
Debugging Effectively
Colin O'Dell
 
Contributing to Drupal
Contributing to Drupal
Chris Skene
 
DDD (Debugger Driven Development)
DDD (Debugger Driven Development)
Carlos Granados
 
Debugging PHP with xDebug inside of Eclipse PDT 2.1
Debugging PHP with xDebug inside of Eclipse PDT 2.1
Bastian Feder
 
Debugging Effectively - php[world] 2015
Debugging Effectively - php[world] 2015
Colin O'Dell
 
Debugging PHP with Xdebug - PHPUK 2018
Debugging PHP with Xdebug - PHPUK 2018
Mark Niebergall
 
Drupal Auckland Meetup; Debug like a pro
Drupal Auckland Meetup; Debug like a pro
Gareth Hall
 
Debugging PHP With Xdebug
Debugging PHP With Xdebug
Mark Niebergall
 
Debugging Effectively - Frederick Web Tech 9/6/16
Debugging Effectively - Frederick Web Tech 9/6/16
Colin O'Dell
 
Voiture tech talk
Voiture tech talk
Hoppinger
 
Debugging Effectively - ConFoo Montreal 2019
Debugging Effectively - ConFoo Montreal 2019
Colin O'Dell
 
Ad

More from Zyxware Technologies (19)

Google Docs - Leverage the power of collaboration with shared documents
Google Docs - Leverage the power of collaboration with shared documents
Zyxware Technologies
 
CETAA Vision 2025 - Making CETAA the best alumni association in India
CETAA Vision 2025 - Making CETAA the best alumni association in India
Zyxware Technologies
 
Learn Drupal 8 Render Pipeline
Learn Drupal 8 Render Pipeline
Zyxware Technologies
 
Come, build your career at Zyxware Technologies
Come, build your career at Zyxware Technologies
Zyxware Technologies
 
Personalized customer experience using ecommerce portal
Personalized customer experience using ecommerce portal
Zyxware Technologies
 
Web Application Performance Audit and Optimization
Web Application Performance Audit and Optimization
Zyxware Technologies
 
Drupal is taking over Australia
Drupal is taking over Australia
Zyxware Technologies
 
Setting in place a product development strategy
Setting in place a product development strategy
Zyxware Technologies
 
Drupal Performance Audit and Optimization
Drupal Performance Audit and Optimization
Zyxware Technologies
 
Drupal as a Rapid Application Development Framework for Non Profits / NGOs
Drupal as a Rapid Application Development Framework for Non Profits / NGOs
Zyxware Technologies
 
An introduction to cyber forensics and open source tools in cyber forensics
An introduction to cyber forensics and open source tools in cyber forensics
Zyxware Technologies
 
Exploring Wider Collaboration Mechanisms in the Drupal Space
Exploring Wider Collaboration Mechanisms in the Drupal Space
Zyxware Technologies
 
The art of communication - managing digital communication
The art of communication - managing digital communication
Zyxware Technologies
 
Code quality - aesthetics & functionality of writing beautiful code
Code quality - aesthetics & functionality of writing beautiful code
Zyxware Technologies
 
Drupal ecosystem in India and Drupal's market potential in India
Drupal ecosystem in India and Drupal's market potential in India
Zyxware Technologies
 
Drupal as a Rapid Application Development (RAD) Framework for Startups
Drupal as a Rapid Application Development (RAD) Framework for Startups
Zyxware Technologies
 
Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...
Zyxware Technologies
 
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Zyxware Technologies
 
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
Zyxware Technologies
 
Google Docs - Leverage the power of collaboration with shared documents
Google Docs - Leverage the power of collaboration with shared documents
Zyxware Technologies
 
CETAA Vision 2025 - Making CETAA the best alumni association in India
CETAA Vision 2025 - Making CETAA the best alumni association in India
Zyxware Technologies
 
Come, build your career at Zyxware Technologies
Come, build your career at Zyxware Technologies
Zyxware Technologies
 
Personalized customer experience using ecommerce portal
Personalized customer experience using ecommerce portal
Zyxware Technologies
 
Web Application Performance Audit and Optimization
Web Application Performance Audit and Optimization
Zyxware Technologies
 
Setting in place a product development strategy
Setting in place a product development strategy
Zyxware Technologies
 
Drupal Performance Audit and Optimization
Drupal Performance Audit and Optimization
Zyxware Technologies
 
Drupal as a Rapid Application Development Framework for Non Profits / NGOs
Drupal as a Rapid Application Development Framework for Non Profits / NGOs
Zyxware Technologies
 
An introduction to cyber forensics and open source tools in cyber forensics
An introduction to cyber forensics and open source tools in cyber forensics
Zyxware Technologies
 
Exploring Wider Collaboration Mechanisms in the Drupal Space
Exploring Wider Collaboration Mechanisms in the Drupal Space
Zyxware Technologies
 
The art of communication - managing digital communication
The art of communication - managing digital communication
Zyxware Technologies
 
Code quality - aesthetics & functionality of writing beautiful code
Code quality - aesthetics & functionality of writing beautiful code
Zyxware Technologies
 
Drupal ecosystem in India and Drupal's market potential in India
Drupal ecosystem in India and Drupal's market potential in India
Zyxware Technologies
 
Drupal as a Rapid Application Development (RAD) Framework for Startups
Drupal as a Rapid Application Development (RAD) Framework for Startups
Zyxware Technologies
 
Collaborative development using git, Session conducted at Model Engineering C...
Collaborative development using git, Session conducted at Model Engineering C...
Zyxware Technologies
 
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Introduction to Bash Scripting, Zyxware Technologies, CSI Students Convention...
Zyxware Technologies
 
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
ICFOSS Interaction with Small and Medium Enterprises on IT Enabling SMEs with...
Zyxware Technologies
 

Recently uploaded (20)

AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
Safe Software
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
The Future of Data, AI, and AR: Innovation Inspired by You.pdf
Safe Software
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
 

Debugging Drupal - How to Debug your Drupal Application

  • 1. Debugging with Drupal The art of Debugging Anoop John, CTO Vimal Joseph, Technical Architect
  • 2. The Art of Debugging Bugs everywhere... SA-CORE-2014-005
  • 3. The Art of Debugging Bug-free Software?
  • 4. The Art of Debugging Debugging It's hard enough to find an error in your code when you're looking for it; it's even harder when you've assumed your code is error-free. Steve McConnel
  • 5. The Art of Debugging Story Time Tell us a story on your debugging experience
  • 6. The Art of Debugging Set up Debugging Environment PHP configuration (php.ini) display_errors = On log_errors = On error_reporting = E_ALL | E_STRICT Drupal modules Devel A good editor Geany Emacs is better – but learning curve is bit steep. Learn to setup a development environment for a given project quickly. Drush will help.
  • 7. The Art of Debugging Debugging Tools - PHP Basic PHP print/echo print_r() exit()/die() debug_backtrace()/debug_print_backtrace()
  • 8. The Art of Debugging Debugging Tools - Drupal drupal_set_message() watchdog() Views views_trace() Devel dpm() dargs() dd() ddebug_backtrace() db_queryd()
  • 9. The Art of Debugging Debugging Tools - HTML, JS, CSS Firebug Web Developer Toolbar Javascript debugger
  • 10. The Art of Debugging Debugging Tools - CLI Drush – a life saver. archive-dump, archive-restore, vget, vset, php- eval, sql-cli, sql-query, user-login etc.. Xdebug cat, grep, awk, cut
  • 11. The Art of Debugging General Approach for Debugging Understand the symptom Understand the context Define problem statement Replicate bug Read through code Isolate location in code causing bug Understand code Understand data / context Understand cause Identify solution Fix bug
  • 12. The Art of Debugging Tips for Debugging Code Trial and error may work – but do not rely on that Binary search is the best method to isolate a bug Learn to navigate through code Learn to read logs Webserver Access/Error logs Database Error logs Drupal error logs Be familiar with the shell commands cat, zcat, grep, less etc..
  • 13. The Art of Debugging Errors, Notices, Warnings Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1566 of /var/www/d7/includes/bootstrap.inc). Invalid argument supplied for foreach() in /var/www/d7/includes/common.inc on line 1919. Illegal offset type in isset or empty in /home/pgil1/public_html/modules/taxon omy/taxonomy.module on line 1090.
  • 14. The Art of Debugging Backtrace – your guide views_trace debug_backtrace debug_print_backtrace ddebug_backtrace
  • 15. The Art of Debugging Tips for Debugging Code // function drupal_set_message() bootstrap.inc if ($type == 'error') { // here are some alternatives – views_trace() // is part of views module // $message .= '<pre>' . print_r(debug_backtrace(), TRUE) . '</pre>'; // $message .= '<pre>' . views_trace() . '</pre>'; } // Or in function watchdog() bootstrap.inc if ($type == 'php') { $message .= '<pre>'. print_r(debug_backtrace(), 1) .'</pre>'; //$message .= '<pre>'. views_trace() .'</pre>'; } // Or in the function which error occurred ddebug_backtrace(); or dpm() or print_r() //make sure to add the necessary conditions so that the debug
  • 16. The Art of Debugging Tips for Debugging Code // Debuging cron // module_invoke() module.inc if ($hook == 'cron') { watchdog('debugging', "CRON: Calling $module"); } // Errors like “Cannot use object of type stdClass as array” // Insert right before the moment of disaster if (!is_array($x)) { dpm(ddebug_backtrace(TRUE)); }
  • 17. The Art of Debugging Tips for Debugging HTML, CSS, JS Inspect using Firebug Create test HTML Set custom properties Walk through JS code execution Inspect variables
  • 18. Zyxware Technologies and Drupal Zyxware is a leading contributor to Drupal from India and is one of only six Featured Service Providers from India listed on drupal.org ● Over 40,000 websites use our modules and themes ● More than 30 contributed modules and themes ● Maintainer of Search404, a top 100 Drupal module ● Over 1000 commits at drupal.org ● Contributes all patches back to Drupal ● Our profile on drupal.org - http://drupal.org/user/222163 ● Knowledge partnerships with Acquia, New Relic and Volacci
  • 19. ● Freedom Walk, a 44 day walk by a team of Free Software Evangelists across the length of Kerala to promote Free Software ● Building RithuOS, an Operating System for Engineering students with Free Software Engineering applications ● GNU/Linux Install Fests in Schools, Colleges and at Technopark. ● Local language (Malayalam) computing camps in colleges ● Building and Maintenance of Freedom Toaster, a Free Software kiosk ● Conducting Free Software workshops and lectures in colleges in Kerala Free Software and Zyxware Technologies
  • 20. • Check us out at http://www.zyxware.com • Mail us at [email protected] • Like us at http://www.facebook.com/zyxware • Follow us at http://www.twitter.com/zyxware • Connect with us at http://www.linkedin.com/companies/zyxware-technologies • Talk to us at +91-9495969446 between 9AM - 9PM IST • Skype me at aj_zyxware Contact Us
  • 21. The Art of Debugging Thank you …
  • 22. The Art of Debugging Credits http://randyfay.com/content/debugging-techniques http://www.lullabot.com/articles/quick_and_dirty_de bugging