php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46255 unexpected success when function should fail
Submitted: 2008-10-08 15:19 UTC Modified: 2008-10-08 17:23 UTC
From: fritz at hoseanetworks dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.2.6 OS: Fedora 8
Private report: No CVE-ID: None
 [2008-10-08 15:19 UTC] fritz at hoseanetworks dot com
Description:
------------
I get a successful file delete using function unlink when I believe it should fail.

Apache is running as user "apache".  
The files are owned by user "root".
The files all have read only permissions "444".

Here is output from ps:
apache    1334  0.1  1.5  39272 16328 ?        S    07:25   0:04 /usr/sbin/httpd

Reproduce code:
---------------
$file = "/var/www/foo/bar.html"
$result = unlink($filename);

Expected result:
----------------
Unlink should fail due to file being read-only and owned by a user other than apache.

Actual result:
--------------
Unlink deletes the file successfully.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-08 17:23 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

For unlink() to work the *directory's* permissions are checked. This is proper Unix behavior.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 07:01:27 2024 UTC