Also, unit tests should definitely find that error.. no? I mean, a simple high level test that use something in config.php should fail.
Of course whenever someone does a fresh pull of the project, that is one file that they'd have to create for themselves. (So this is documented very clearly.)
It's minor inconvenience but it solves the problems like this.
SetEnv DB_USER=kermit SetEnv DB_PASS=Shhh
And then connect to the DB using code such as:
mysql_connect(getenv('DB_NAME'), getenv('DB_USER'), getenv('DB_PASS'))
Environmental config data should never be stored in source code.
Edit: Unless of course you're using YAML or some other representation rather than a pure PHP file.
Edit: Here's a way to force 500 for fatal errors in PHP http://blog.kevburnsjr.com/php-fatal-error-500
How would that have helped here? The file was obviously still valid syntactically. Try it for yourself: create a PHP file that looks like
and run it through PHP's syntax check (php -l /path/to/file from the command line). It will verify that the script is valid. However, the content will still not be parsed as PHP.One way to fix this is to store your configuration data in another file format (eg: YAML) outside of the document root. Since the configuration file doesn't try to be parsed as PHP, it can't be leaked in this way.