Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Does the act of defining constants create a global level security vulnerability?
I understand that in sophisticated programming, encapsulation and obfuscation are important when creating secure applications. So wouldn't this be a bad practice?
Chris Shaw26,649 Points
Constants are a lot like variables, the key difference is you can only define constants once meaning they are somewhat more secure than a variable since you can alter it's data at any point in time.
I recommend you have a look at the
wp-config.php file in WordPress as it uses constants numerous times throughout it's code base which hasn't contributed to any vulnerabilities once in it's lifetime as a blogging system.
Hope that helps.