ID:               30279
 Updated by:       [EMAIL PROTECTED]
 Reported By:      pviet at azuria dot com
 Status:           Bogus
 Bug Type:         CGI related
 Operating System: Linux
 PHP Version:      4.3.9
 New Comment:

In some cases it may have access to the directory and in other cases it
may not. So rather then return 2 different error codes for the same
error PHP tries to be consistent.


Previous Comments:
------------------------------------------------------------------------

[2004-09-30 03:54:59] pviet at azuria dot com

Isn't it more logical that denied should return 403.. ?
(and keep 404 for when php KNOWS the file doesn't exist, eg. has access
to the directory)

------------------------------------------------------------------------

[2004-09-30 03:28:41] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP has no way of knowing if a file existings when it does not have
permission to access. Hence the 404 error message.

------------------------------------------------------------------------

[2004-09-29 19:27:02] pviet at azuria dot com

Description:
------------
Status 404 instead of 403 when file passed via environment is not
accessible. This leads to error on debugging and took me about 7hrs to
find what was really happening
(wrong rights)

Reproduce code:
---------------
Abstract :
- A PHP file is called x.php, located in /data/www/x.php
- My user is called someunixuser
- This someunixuser can't read the file because lacking unix
permissions (not owner, 0700 or so on)

mybox:~$ cat /data/www/x.php
cat: /data/www/x.php: Permission denied

mybox:~$ env SCRIPT_FILENAME=/data/www/x.php /usr/bin/php
Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.9

No input file specified.
mybox:~$

Expected result:
----------------
Return a 403 and "Permission denied on /data/web/x.php"

Actual result:
--------------
Return a 404 and "No input files"


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30279&edit=1

Reply via email to