There is more than one good reason.
Do
error_reporting(E_ALL);
in the beginning of your script and you will see all the reasons at once.
Fun aside, in practice you might think that well, this is something that I might get away with. And you could be right. But as a developer you have to draw the line somewhere about what is an acceptable hack and what is reason for verbal abuse. For me, this particular behavior is beyond that line.
The very immediate reason why this is bad is that it makes error_reporting(E_ALL)
unusable. And good development practice demands that all errors are reported, these notices are setting you up for buggier code and harder debugging sessions.
Update: I didn't address the issue of a practical solution to the existing situation, so here's what I would do in your shoes:
- Find the person responsible and make sure that they never, ever do this again by any means necessary.
- Run a problematic script and get all the notices about undefined constants from the log file.
- Using regex search and replace from your editor, try to replace
\[(a-zA-Z_-)\]
to ['$1']
(or something similar). If the number of replacements is equal to the number of notices in the log file, you are golden. Otherwise, try divide and conquer until you see where the regex is failing.
- Repeat as required for all the other scripts.