Re:How to prevent a leak like Tumblr’s
by KevBurnsJr on Saturday March 19, 2011 @10:15AM
(#2343621)
Wow, you're right. I sort of assumed it would pick up on an error like this.
[ Parent
| on HN ]
It physically can't: without the opening PHP tag the parser just thinks the entire file is HTML to be outputted to the browser, which is still a valid PHP file. ;)
Re:How to prevent a leak like Tumblr’s
by KevBurnsJr on Saturday March 19, 2011 @10:25AM
(#2343650)
I suppose you could also write a quick bash script to ensure the first 5 characters of any .class.php file matches "<?php", but it wouldn't be very generally applicable and wouldn't fix a problem like this for a file named config.php
Re:How to prevent a leak like Tumblr’s
by KevBurnsJr on Saturday March 19, 2011 @10:38AM
(#2343679)
I suppose you could add some code to Varnish to tell it to squelch any and all 500 responses.
Re:How to prevent a leak like Tumblr’s
by KevBurnsJr on Saturday March 19, 2011 @10:56AM
(#2343725)
Looks like PHP returns a 200 when it encounters a fatal error.
Edit: Here's a way to force 500 for fatal errors in PHP http://blog.kevburnsjr.com/php-fatal-error-500