
Kyle Barrett - 2011-11-02 18:44:26 -
In reply to message 1 from Rineez Ahmed
It could cause conflict if you post a form field with a name of an existing constant. Another possible hiccup would be that when a constant value CONSTANT_NAME isn't defined it will not default to NULL, but PHP will assume you meant a string of "CONSTANT_NAME"; though this shouldn't be an issue with proper validation.
In a multi-tier application, you'd really be mucking about with mixing user-input and business logic (you have this problem with a $_POST superglobal as well, but atleast it's easily identifiable as a superglobal). Constants should be reserved for constant variables. User input by definition isn't constant; if the user doesn't make a submission, then the constant won't exist. Not really "wrong" in the sense that it won't work, but wrong in the sense that you're using a screw driver to hammer a nail.