|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-20 20:50 UTC] heiglandreas@php.net
-Status: Open
+Status: Not a bug
-Package: Feature/Change Request
+Package: *General Issues
[2017-01-20 20:50 UTC] heiglandreas@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 23:00:01 2026 UTC |
Description: ------------ On Mac OS X, when fopen() fails with a permission denied error, the result of a subsequent posix_get_last_error() call is zero (0). I would expect this to be set to the value of errno returned by the underlying open or fopen call. I would also expect this to work for put_file_contents, but also get a rather useless zero when calling posix_get_last_error() after that fails. However, since that isn't a POSIX function, I can accept that it wouldn't behave in this way... but fopen is a standard POSIX function, and should be setting errno. Currently, it appears that without explicitly doing a stat on the directory, it is impossible to distinguish a permissions problem from some other error return (e.g. file exists, I/O error, etc.). Reproduce code: --------------- $fp = fopen("/unwritabledirectory/filename", "w"); if (!$fp) { print "Error was: ".posix_get_last_error().".\n"; } Expected result: ---------------- I would expect the fopen to fail with a permission denied error, errno to be set appropriately, and posix_get_last_error () to fetch that value. Actual result: -------------- Error is always zero (0).