Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
- What are the steps required to reproduce the bug?
call:file_check_directory($directory, FILE_CREATE_DIRECTORY, $element);
with a directory whose parent does not exist
eg files/foo/bar where files/ exists but not files/foo - What behavior were you expecting?
i would expect it to at least try to make files/foo and then files/foo/bar - What happened instead?
drupal fails silently!!
why is this a problem?
file_check_directory should not fail unless it really can't create the directory
because module developers should be able to call
-- file_check_directory($directory, FILE_CREATE_DIRECTORY, $element);
without having to
-- either call file_check_directory a million times (once for each) parent
-- OR call mkdir themselves
Comment | File | Size | Author |
---|---|---|---|
#10 | 180970-file_check_directory.patch | 1015 bytes | ygerasimov |
#5 | file-180970.patch | 810 bytes | johannesdr |
file.inc__1.patch | 606 bytes | treksler | |
Comments
Comment #1
treksler CreditAttribution: treksler commentedactually a umask might be needed to get the proper permissions with mkdir
i ended up using
if (($mode & FILE_CREATE_DIRECTORY) && @umask(0002) && @mkdir($directory, 0775, TRUE)) {
but i suppose the old umask could be preserved and set back if desired
the only question is how does (even temporarily) changing umask affect other sites on the same server
Comment #2
zeta ζ CreditAttribution: zeta ζ commentedHow do I
? Is this for module programmers or does part of a drupal form use this to do its job?Is this bug still present in -dev?
Comment #3
johannesdr CreditAttribution: johannesdr commentedThis has been solved in drupal 7: #515280: file_check_directory() should create recursively
Perhaps it should be backported to Drupal 6?
So I think irstudio's patch is good, it works for me.
Comment #5
johannesdr CreditAttribution: johannesdr commentedupdated patch to latest cvs version
Comment #7
brad.bulger CreditAttribution: brad.bulger commented#5: file-180970.patch queued for re-testing.
Comment #9
brad.bulger CreditAttribution: brad.bulger commentedthis seems to be an issue with D6 testing - #961172: All D6 Core patches are failing
Comment #10
ygerasimov CreditAttribution: ygerasimov commentedThank you for patch. It really helps. Patch rerolled with git.
Comment #11
Gábor HojtsyUnfortunately PHP 5.0 introduced the third parameter, so we cannot just assume that is going to work on all supported PHP versions for Drupal 6. Drupal 6 should work on PHP 4.3.5 or later. In general I think it would be great to give this more eyes and testing.