#30279 [Bgs]: 404 instead of 403 when permission denied
| From: | pviet at azuria dot com | Date: | Thu, 30 Sep 2004 01:55:00 +0000 |
| Subject: | #30279 [Bgs]: 404 instead of 403 when permission denied | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66913@lists.php.net to get a copy of this message | ||
ID: 30279
User updated by: pviet at azuria dot com
Reported By: pviet at azuria dot com
Status: Bogus
Bug Type: CGI related
Operating System: Linux
PHP Version: 4.3.9
New Comment:
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)
Previous Comments:
------------------------------------------------------------------------
[2004-09-30 03:28:41] iliaa@php.net
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