Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
file system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
2 Oct 2013 at 12:27 UTC
Updated:
17 Oct 2015 at 11:04 UTC
Jump to comment: Most recent
API page: https://api.drupal.org/api/drupal/includes%21file.inc/function/file_prep...
If you have a valid file_uri_scheme (e.g. public) and the directory exists then an attempt is made to use is_writable('public://mydirectory/myfile') which will return FALSE as we are passing a URI instead of full filename to is_writable
Using drupal_realpath($directory) will not always work either as passing a full filename to drupal_realpath instead of a URI will return FALSE from drupal_realpath.
I would suggest this:
$writable = is_writable(drupal_realpath($directory) == FALSE ? $directory : drupal_realpath($directory));
Patch attached
| Comment | File | Size | Author |
|---|---|---|---|
| file-21914.patch | 570 bytes | carlhinton |
Comments
Comment #1
carlhinton commentedComment #2
gmclelland commentedSimilar issue
Comment #3
dooug commentedThis is similar to #1333390: file_prepare_directory() / is_writable() on Linux don't support ACLs which points to this issue which has lots of work that should solve the problem: #944582: Check for execute permissions on directories that require file write permissions
So I'm closing this in favor of the ongoing work on: #944582: Check for execute permissions on directories that require file write permissions
Comment #4
cleverhoods commentedAnother solution (for Drupal 7)
You can solve this issue by defining your own Stream Wrapper.
Via: Writing Stream Wrappers