Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSean Lum
11,949 PointsDoes 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?
1 Answer
Chris Shaw
26,676 PointsHi Sean,
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.