Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.243 diff -u -p -r1.243 file.inc --- includes/file.inc 15 Dec 2010 03:39:41 -0000 1.243 +++ includes/file.inc 20 Dec 2010 00:58:49 -0000 @@ -452,7 +452,7 @@ function file_prepare_directory(&$direct return FALSE; } // The directory exists, so check to see if it is writable. - $writable = is_writable($directory); + $writable = is_writable($directory) && drupal_is_executable($directory); if (!$writable && ($options & FILE_MODIFY_PERMISSIONS)) { return drupal_chmod($directory); } @@ -2212,6 +2212,27 @@ function drupal_dirname($uri) { } /** + * Determines if a file or directory is executable. + * + * PHP's is_executable() does not fully support stream wrappers, so this + * function fills that gap. + * + * @param $uri + * A URI or pathname pointing to the file or directory that will be checked. + * + * @return + * TRUE if the file or directory is executable; FALSE otherwise. + * + * @see is_executable() + * @ingroup php_wrappers + */ +function drupal_is_executable($uri) { + // By converting the URI to a normal path using drupal_realpath(), we can + // correctly handle both stream wrappers and normal paths. + return is_executable(drupal_realpath($uri)); +} + +/** * Creates a directory using Drupal's default mode. * * PHP's mkdir() does not respect Drupal's default permissions mode. If a mode @@ -2351,7 +2372,7 @@ function file_directory_temp() { } foreach ($directories as $directory) { - if (is_dir($directory) && is_writable($directory)) { + if (is_dir($directory) && is_writable($directory) && drupal_is_executable($directory)) { $temporary_directory = $directory; break; } Index: includes/install.core.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.core.inc,v retrieving revision 1.47 diff -u -p -r1.47 install.core.inc --- includes/install.core.inc 19 Dec 2010 19:26:21 -0000 1.47 +++ includes/install.core.inc 20 Dec 2010 00:58:49 -0000 @@ -1571,7 +1571,7 @@ function install_check_requirements($ins // Otherwise, if settings.php does not exist yet, we can try to copy // default.settings.php to create it. elseif (!$exists) { - $copied = drupal_verify_install_file($conf_path, FILE_EXIST|FILE_WRITABLE, 'dir') && @copy($default_settings_file, $settings_file); + $copied = drupal_verify_install_file($conf_path, FILE_EXIST|FILE_WRITABLE|FILE_EXECUTABLE, 'dir') && @copy($default_settings_file, $settings_file); if ($copied) { // If the new settings file has the same owner as default.settings.php, // this means default.settings.php is owned by the webserver user. Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.150 diff -u -p -r1.150 install.inc --- includes/install.inc 29 Nov 2010 04:45:10 -0000 1.150 +++ includes/install.inc 20 Dec 2010 00:58:49 -0000 @@ -884,7 +884,7 @@ function drupal_verify_install_file($fil } break; case FILE_EXECUTABLE: - if (!is_executable($file) && !drupal_install_fix_file($file, $mask)) { + if (!drupal_is_executable($file) && !drupal_install_fix_file($file, $mask)) { $return = FALSE; } break; @@ -899,7 +899,7 @@ function drupal_verify_install_file($fil } break; case FILE_NOT_EXECUTABLE: - if (is_executable($file) && !drupal_install_fix_file($file, $mask)) { + if (drupal_is_executable($file) && !drupal_install_fix_file($file, $mask)) { $return = FALSE; } break; @@ -997,7 +997,7 @@ function drupal_install_fix_file($file, } break; case FILE_EXECUTABLE: - if (!is_executable($file)) { + if (!drupal_is_executable($file)) { $mod |= 0111; } break; @@ -1012,7 +1012,7 @@ function drupal_install_fix_file($file, } break; case FILE_NOT_EXECUTABLE: - if (is_executable($file)) { + if (drupal_is_executable($file)) { $mod &= ~0111; } break; Index: includes/updater.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/updater.inc,v retrieving revision 1.7 diff -u -p -r1.7 updater.inc --- includes/updater.inc 1 Sep 2010 20:08:17 -0000 1.7 +++ includes/updater.inc 20 Dec 2010 00:58:50 -0000 @@ -307,7 +307,7 @@ class Updater { // Make the parent dir writable if need be and create the dir. if (!is_dir($directory)) { $parent_dir = dirname($directory); - if (!is_writable($parent_dir)) { + if (!is_writable($parent_dir) || !drupal_is_executable($parent_dir)) { @chmod($parent_dir, 0755); // It is expected that this will fail if the directory is owned by the // FTP user. If the FTP user == web server, it will succeed. @@ -349,7 +349,7 @@ class Updater { * If the chmod should be applied recursively. */ public function makeWorldReadable(&$filetransfer, $path, $recursive = TRUE) { - if (!is_executable($path)) { + if (!drupal_is_executable($path)) { // Set it to read + execute. $new_perms = substr(sprintf('%o', fileperms($path)), -4, -1) . "5"; $filetransfer->chmod($path, intval($new_perms, 8), $recursive); Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.326 diff -u -p -r1.326 system.admin.inc --- modules/system/system.admin.inc 23 Nov 2010 02:54:13 -0000 1.326 +++ modules/system/system.admin.inc 20 Dec 2010 00:58:50 -0000 @@ -1672,7 +1672,7 @@ function system_performance_settings() { ); $directory = 'public://'; - $is_writable = is_dir($directory) && is_writable($directory); + $is_writable = is_dir($directory) && is_writable($directory) && drupal_is_executable($directory); $disabled = !$is_writable; $disabled_message = ''; if (!$is_writable) { Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.530 diff -u -p -r1.530 system.install --- modules/system/system.install 18 Dec 2010 00:43:04 -0000 1.530 +++ modules/system/system.install 20 Dec 2010 00:58:50 -0000 @@ -332,7 +332,7 @@ function system_requirements($phase) { if ($phase == 'install') { file_prepare_directory($directory, FILE_CREATE_DIRECTORY); } - $is_writable = is_writable($directory); + $is_writable = is_writable($directory) && drupal_is_executable($directory); $is_directory = is_dir($directory); if (!$is_writable || !$is_directory) { $description = ''; Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.999 diff -u -p -r1.999 system.module --- modules/system/system.module 15 Dec 2010 02:59:01 -0000 1.999 +++ modules/system/system.module 20 Dec 2010 00:58:51 -0000 @@ -2149,7 +2149,7 @@ function system_check_directory($form_el watchdog('file system', 'The directory %directory does not exist and could not be created.', array('%directory' => $directory), WATCHDOG_ERROR); } - if (is_dir($directory) && !is_writable($directory) && !drupal_chmod($directory)) { + if (is_dir($directory) && (!is_writable($directory) || !drupal_is_executable($directory)) && !drupal_chmod($directory)) { // If the directory is not writable and cannot be made so. form_set_error($form_element['#parents'][0], t('The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory))); watchdog('file system', 'The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory), WATCHDOG_ERROR); Index: modules/user/user.test =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.test,v retrieving revision 1.111 diff -u -p -r1.111 user.test --- modules/user/user.test 18 Dec 2010 00:56:18 -0000 1.111 +++ modules/user/user.test 20 Dec 2010 00:58:51 -0000 @@ -847,7 +847,7 @@ class UserPictureTestCase extends Drupal $picture_path = $file_dir . $picture_dir; $pic_check = file_prepare_directory($picture_path, FILE_CREATE_DIRECTORY); - $this->_directory_test = is_writable($picture_path); + $this->_directory_test = is_writable($picture_path) && drupal_is_executable($picture_path); $this->assertTrue($this->_directory_test, "The directory $picture_path doesn't exist or is not writable. Further tests won't be made."); }