View Single Post
Old 10-11-2012, 08:07 PM   PM User | #3
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
Quote:
Originally Posted by poyzn View Post
Yes, I did briefly consider that, but only tried it to see the behavior once you mentioned it. I used this:
PHP Code:

if(file_exists('alpha.php'))
  { include 
'alpha.php'; } 
else { 
header('/'); } 
- It produces an HTTP 500 when the file doesn't exist (And used with an invalid header call like this, obviously), regardless of whether PHP error reporting is on or not. Again, I find myself confused as to why some errors send HTTP 500 and why some are content with sending a blank page. (This is even more confusing, because I expected a "Headers already sent" at least).

- Doesn't matter to it if the file that exists is producing fatal errors or not, so it's pretty much doing the same as the if(include 'alpha.php') I was experimenting with. With the exception that it doesn't use the php.ini include path, which is kind of important. (Yeah I could get the path via ini_get, but so far using file_exists doesn't seem to solve the problem. It still seems inconsistent or 'hack-ish' getting the error this way, and can't find the status of the file.)

Thanks anyway..
Custard7A is offline   Reply With Quote