diff --git a/includes/common.inc b/includes/common.inc index b6ea297..352543e 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2924,7 +2924,7 @@ function drupal_get_css($css = NULL, $skip_alter = FALSE) { foreach ($css as $key => $item) { if ($item['type'] == 'file') { // If defined, force a unique basename for this file. - $basename = isset($item['basename']) ? $item['basename'] : basename($item['data']); + $basename = isset($item['basename']) ? $item['basename'] : drupal_basename($item['data']); if (isset($previous_item[$basename])) { // Remove the previous item that shared the same base name. unset($css[$previous_item[$basename]]); diff --git a/includes/file.inc b/includes/file.inc index 26a6c41..e0ab2dd 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -765,7 +765,7 @@ function file_copy(stdClass $source, $destination = NULL, $replace = FILE_EXISTS $file = clone $source; $file->fid = NULL; $file->uri = $uri; - $file->filename = basename($uri); + $file->filename = drupal_basename($uri); // If we are replacing an existing file re-use its database record. if ($replace == FILE_EXISTS_REPLACE) { $existing_files = file_load_multiple(array(), array('uri' => $uri)); @@ -778,7 +778,7 @@ function file_copy(stdClass $source, $destination = NULL, $replace = FILE_EXISTS // If we are renaming around an existing file (rather than a directory), // use its basename for the filename. elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) { - $file->filename = basename($destination); + $file->filename = drupal_basename($destination); } $file = file_save($file); @@ -858,14 +858,14 @@ function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXIST // Build a destination URI if necessary. if (!isset($destination)) { - $destination = file_build_uri(basename($source)); + $destination = file_build_uri(drupal_basename($source)); } // Prepare the destination directory. if (file_prepare_directory($destination)) { // The destination is already a directory, so append the source basename. - $destination = file_stream_wrapper_uri_normalize($destination . '/' . basename($source)); + $destination = file_stream_wrapper_uri_normalize($destination . '/' . drupal_basename($source)); } else { // Perhaps $destination is a dir/file? @@ -939,7 +939,7 @@ function file_destination($destination, $replace) { break; case FILE_EXISTS_RENAME: - $basename = basename($destination); + $basename = drupal_basename($destination); $directory = drupal_dirname($destination); $destination = file_create_filename($basename, $directory); break; @@ -1010,7 +1010,7 @@ function file_move(stdClass $source, $destination = NULL, $replace = FILE_EXISTS // If we are renaming around an existing file (rather than a directory), // use its basename for the filename. elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) { - $file->filename = basename($destination); + $file->filename = drupal_basename($destination); } $file = file_save($file); @@ -1427,7 +1427,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE, $file = new stdClass(); $file->uid = $user->uid; $file->status = 0; - $file->filename = trim(basename($_FILES['files']['name'][$source]), '.'); + $file->filename = trim(drupal_basename($_FILES['files']['name'][$source]), '.'); $file->uri = $_FILES['files']['tmp_name'][$source]; $file->filemime = file_get_mimetype($file->filename); $file->filesize = $_FILES['files']['size'][$source]; @@ -1789,7 +1789,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM $file = new stdClass(); $file->fid = NULL; $file->uri = $uri; - $file->filename = basename($uri); + $file->filename = drupal_basename($uri); $file->filemime = file_get_mimetype($file->uri); $file->uid = $user->uid; $file->status = FILE_STATUS_PERMANENT; @@ -1805,7 +1805,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM // If we are renaming around an existing file (rather than a directory), // use its basename for the filename. elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) { - $file->filename = basename($destination); + $file->filename = drupal_basename($destination); } return file_save($file); @@ -2210,6 +2210,30 @@ function drupal_dirname($uri) { } /** + * Gets the filename from a given path. + * + * PHP's basename() does not properly support streams or filenames beginning + * with a non-US-ASCII character. + * + * @see http://bugs.php.net/bug.php?id=37738 + * @see basename() + * + * @ingroup php_wrappers + */ +function drupal_basename($uri, $suffix = NULL) { + $separators = '/'; + if (DIRECTORY_SEPARATOR != '/') { + $separators .= DIRECTORY_SEPARATOR; + } + $uri = rtrim($uri, $separators); + $uri = preg_match('@[^' . preg_quote($separators, '@') . ']+$@', $uri, $matches) ? $matches[0] : ''; + if ($suffix) { + $uri = preg_replace('@' . preg_quote($suffix) . '$@', '', $uri); + } + return $uri; +} + +/** * Creates a directory using Drupal's default mode. * * PHP's mkdir() does not respect Drupal's default permissions mode. If a mode @@ -2305,7 +2329,7 @@ function drupal_tempnam($directory, $prefix) { $wrapper = file_stream_wrapper_get_instance_by_scheme($scheme); if ($filename = tempnam($wrapper->getDirectoryPath(), $prefix)) { - return $scheme . '://' . basename($filename); + return $scheme . '://' . drupal_basename($filename); } else { return FALSE; diff --git a/includes/filetransfer/filetransfer.inc b/includes/filetransfer/filetransfer.inc index 2083da9..bc16da7 100644 --- a/includes/filetransfer/filetransfer.inc +++ b/includes/filetransfer/filetransfer.inc @@ -211,7 +211,7 @@ abstract class FileTransfer { */ protected function copyDirectoryJailed($source, $destination) { if ($this->isDirectory($destination)) { - $destination = $destination . '/' . basename($source); + $destination = $destination . '/' . drupal_basename($source); } $this->createDirectory($destination); foreach (new RecursiveIteratorIterator(new SkipDotsRecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST) as $filename => $file) { @@ -302,7 +302,7 @@ abstract class FileTransfer { $chroot = ''; while (count($parts)) { $check = implode($parts, '/'); - if ($this->isFile($check . '/' . basename(__FILE__))) { + if ($this->isFile($check . '/' . drupal_basename(__FILE__))) { // Remove the trailing slash. return substr($chroot,0,-1); } diff --git a/includes/locale.inc b/includes/locale.inc index e60b8dd..b6a0878 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -2170,7 +2170,7 @@ function _locale_batch_import($filepath, &$context) { // The filename is either {langcode}.po or {prefix}.{langcode}.po, so // we can extract the language code to use for the import from the end. if (preg_match('!(/|\.)([^\./]+)\.po$!', $filepath, $langcode)) { - $file = (object) array('filename' => basename($filepath), 'uri' => $filepath); + $file = (object) array('filename' => drupal_basename($filepath), 'uri' => $filepath); _locale_import_read_po('db-store', $file, LOCALE_IMPORT_KEEP, $langcode[2]); $context['results'][] = $filepath; } diff --git a/includes/stream_wrappers.inc b/includes/stream_wrappers.inc index df380a8..7c372b2 100644 --- a/includes/stream_wrappers.inc +++ b/includes/stream_wrappers.inc @@ -317,7 +317,7 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface } $extension = ''; - $file_parts = explode('.', basename($uri)); + $file_parts = explode('.', drupal_basename($uri)); // Remove the first part: a full filename should not match an extension. array_shift($file_parts); @@ -365,7 +365,7 @@ abstract class DrupalLocalStreamWrapper implements DrupalStreamWrapperInterface $realpath = realpath($path); if (!$realpath) { // This file does not yet exist. - $realpath = realpath(dirname($path)) . '/' . basename($path); + $realpath = realpath(dirname($path)) . '/' . drupal_basename($path); } $directory = realpath($this->getDirectoryPath()); if (!$realpath || !$directory || strpos($realpath, $directory) !== 0) { diff --git a/includes/updater.inc b/includes/updater.inc index 363c6eb..9801629 100644 --- a/includes/updater.inc +++ b/includes/updater.inc @@ -141,7 +141,7 @@ class Updater { return FALSE; } foreach ($info_files as $info_file) { - if (drupal_substr($info_file->filename, 0, -5) == basename($directory)) { + if (drupal_substr($info_file->filename, 0, -5) == drupal_basename($directory)) { // Info file Has the same name as the directory, return it. return $info_file->uri; } @@ -163,7 +163,7 @@ class Updater { * The name of the project. */ public static function getProjectName($directory) { - return basename($directory); + return drupal_basename($directory); } /** diff --git a/modules/color/color.module b/modules/color/color.module index ff6c70e..bae6a48 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -85,7 +85,7 @@ function _color_html_alter(&$vars) { foreach ($color_paths as $color_path) { // Color module currently requires unique file names to be used, // which allows us to compare different file paths. - if (basename($old_path) == basename($color_path)) { + if (drupal_basename($old_path) == drupal_basename($color_path)) { // Replace the path to the new css file. // This keeps the order of the stylesheets intact. $vars['css'][$old_path]['data'] = $color_path; @@ -345,7 +345,7 @@ function color_scheme_form_submit($form, &$form_state) { // Copy over neutral images. foreach ($info['copy'] as $file) { - $base = basename($file); + $base = drupal_basename($file); $source = $paths['source'] . $file; $filepath = file_unmanaged_copy($source, $paths['target'] . $base); $paths['map'][$file] = $base; @@ -387,7 +387,7 @@ function color_scheme_form_submit($form, &$form_state) { // Rewrite stylesheet with new colors. $style = _color_rewrite_stylesheet($theme, $info, $paths, $palette, $style); - $base_file = basename($file); + $base_file = drupal_basename($file); $css[] = $paths['target'] . $base_file; _color_save_stylesheet($paths['target'] . $base_file, $style, $paths); } @@ -527,7 +527,7 @@ function _color_render_images($theme, &$info, &$paths, $palette) { // Cut out slices. foreach ($info['slices'] as $file => $coord) { list($x, $y, $width, $height) = $coord; - $base = basename($file); + $base = drupal_basename($file); $image = drupal_realpath($paths['target'] . $base); // Cut out slice. diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test index ea8c5c6..2bcbbee 100644 --- a/modules/file/tests/file.test +++ b/modules/file/tests/file.test @@ -709,6 +709,9 @@ class FileFieldDisplayTestCase extends FileFieldTestCase { $instance = field_info_instance('node', $field_name, $type_name); $test_file = $this->getTestFile('text'); + // Coping a file to test uploads with non-latin filenames. + $filename = drupal_dirname($test_file->uri) . '/текстовый файл.txt'; + $test_file = file_copy($test_file, $filename); // Create a new node with the uploaded file. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); diff --git a/modules/image/image.test b/modules/image/image.test index 00f79d8..4152c0e 100644 --- a/modules/image/image.test +++ b/modules/image/image.test @@ -192,7 +192,7 @@ class ImageStylesPathAndUrlUnitTest extends DrupalWebTestCase { $this->assertNotIdentical(FALSE, $original_uri, t('Created the generated image file.')); // Get the URL of a file that has not been generated and try to create it. - $generated_uri = $scheme . '://styles/' . $this->style_name . '/' . $scheme . '/'. basename($original_uri); + $generated_uri = $scheme . '://styles/' . $this->style_name . '/' . $scheme . '/'. drupal_basename($original_uri); $this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.')); $generate_url = image_style_url($this->style_name, $original_uri); diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index b60c682..040ce8f 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1625,7 +1625,16 @@ class DrupalWebTestCase extends DrupalTestCase { * An header. */ protected function curlHeaderCallback($curlHandler, $header) { - $this->headers[] = $header; + // Header fields can be extended over multiple lines by preceding each + // extra line with at least one SP or HT. They should be joined on receive. + // Details are in RFC2616 section 4. + if ($header[0] == ' ' || $header[0] == "\t") { + // Normalize whitespace between chucks. + $this->headers[] = array_pop($this->headers) . ' ' . trim($header); + } + else { + $this->headers[] = $header; + } // Errors are being sent via X-Drupal-Assertion-* headers, // generated by _drupal_log_error() in the exact form required diff --git a/modules/simpletest/simpletest.pages.inc b/modules/simpletest/simpletest.pages.inc index 31d0b2c..87b347a 100644 --- a/modules/simpletest/simpletest.pages.inc +++ b/modules/simpletest/simpletest.pages.inc @@ -266,7 +266,7 @@ function simpletest_result_form($form, &$form_state, $test_id) { $row = array(); $row[] = $assertion->message; $row[] = $assertion->message_group; - $row[] = basename($assertion->file); + $row[] = drupal_basename($assertion->file); $row[] = $assertion->line; $row[] = $assertion->function; $row[] = simpletest_result_status_image($assertion->status); diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 4664f04..8096a35 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -2038,7 +2038,7 @@ class DrupalErrorCollectionUnitTest extends DrupalWebTestCase { function assertError($error, $group, $function, $file, $message = NULL) { $this->assertEqual($error['group'], $group, t("Group was %group", array('%group' => $group))); $this->assertEqual($error['caller']['function'], $function, t("Function was %function", array('%function' => $function))); - $this->assertEqual(basename($error['caller']['file']), $file, t("File was %file", array('%file' => $file))); + $this->assertEqual(drupal_basename($error['caller']['file']), $file, t("File was %file", array('%file' => $file))); if (isset($message)) { $this->assertEqual($error['message'], $message, t("Message was %message", array('%message' => $message))); } diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test index dc12b1b..3794816 100644 --- a/modules/simpletest/tests/file.test +++ b/modules/simpletest/tests/file.test @@ -198,7 +198,9 @@ class FileTestCase extends DrupalWebTestCase { */ function createFile($filepath = NULL, $contents = NULL, $scheme = 'public') { if (!isset($filepath)) { - $filepath = $this->randomName(); + // Prefix with non-latin characters to ensure that all file-related + // tests work with international filenames. + $filepath = 'Файл для тестирования ' . $this->randomName(); } $filepath = $scheme . '://' . $filepath; @@ -211,7 +213,7 @@ class FileTestCase extends DrupalWebTestCase { $file = new stdClass(); $file->uri = $filepath; - $file->filename = basename($file->uri); + $file->filename = drupal_basename($file->uri); $file->filemime = 'text/plain'; $file->uid = 1; $file->timestamp = REQUEST_TIME; @@ -369,11 +371,11 @@ class FileValidatorTest extends DrupalWebTestCase { $this->image = new stdClass(); $this->image->uri = 'misc/druplicon.png'; - $this->image->filename = basename($this->image->uri); + $this->image->filename = drupal_basename($this->image->uri); $this->non_image = new stdClass(); $this->non_image->uri = 'misc/jquery.js'; - $this->non_image->filename = basename($this->non_image->uri); + $this->non_image->filename = drupal_basename($this->non_image->uri); } /** @@ -536,7 +538,7 @@ class FileUnmanagedSaveDataTest extends FileTestCase { // Provide a filename. $filepath = file_unmanaged_save_data($contents, 'public://asdf.txt', FILE_EXISTS_REPLACE); $this->assertTrue($filepath, t('Unnamed file saved correctly.')); - $this->assertEqual('asdf.txt', basename($filepath), t('File was named correctly.')); + $this->assertEqual('asdf.txt', drupal_basename($filepath), t('File was named correctly.')); $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), t('Contents of the file are correct.')); $this->assertFilePermissions($filepath, variable_get('file_chmod_file', 0664)); } @@ -647,7 +649,7 @@ class FileSaveUploadTest extends FileHookTestCase { $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); $this->assertRaw(t('You WIN!')); - $this->assertTrue(is_file('temporary://' . $dir . '/' . trim(basename($image3_realpath)))); + $this->assertTrue(is_file('temporary://' . $dir . '/' . trim(drupal_basename($image3_realpath)))); // Check that file_load_multiple() with no arguments returns FALSE. $this->assertFalse(file_load_multiple(), t('No files were loaded.')); @@ -2075,7 +2077,7 @@ class FileSaveDataTest extends FileHookTestCase { $this->assertTrue($result, t('Unnamed file saved correctly.')); $this->assertEqual(file_default_scheme(), file_uri_scheme($result->uri), t("File was placed in Drupal's files directory.")); - $this->assertEqual($result->filename, basename($result->uri), t("Filename was set to the file's basename.")); + $this->assertEqual($result->filename, drupal_basename($result->uri), t("Filename was set to the file's basename.")); $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.')); $this->assertEqual($result->filemime, 'application/octet-stream', t('A MIME type was set.')); $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent.")); @@ -2093,11 +2095,14 @@ class FileSaveDataTest extends FileHookTestCase { function testWithFilename() { $contents = $this->randomName(8); - $result = file_save_data($contents, 'public://' . 'asdf.txt'); + // Using filename with non-latin characters. + $filename = 'Текстовый файл.txt'; + + $result = file_save_data($contents, 'public://' . $filename); $this->assertTrue($result, t('Unnamed file saved correctly.')); $this->assertEqual('public', file_uri_scheme($result->uri), t("File was placed in Drupal's files directory.")); - $this->assertEqual('asdf.txt', basename($result->uri), t('File was named correctly.')); + $this->assertEqual($filename, drupal_basename($result->uri), t('File was named correctly.')); $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.')); $this->assertEqual($result->filemime, 'text/plain', t('A MIME type was set.')); $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent.")); @@ -2209,7 +2214,10 @@ class FileDownloadTest extends FileTestCase { // Test generating an URL to a created file. $file = $this->createFile(); $url = file_create_url($file->uri); - $this->assertEqual($GLOBALS['base_url'] . '/' . file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . $file->filename, $url, t('Correctly generated a URL for a created file.')); + // URLs can't contain characters outside the ASCII set so $filename has to be + // encoded. + $filename = $GLOBALS['base_url'] . '/' . file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . rawurlencode($file->filename); + $this->assertEqual($filename, $url, t('Correctly generated a URL for a created file.')); $this->drupalHead($url); $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the created file.')); @@ -2229,16 +2237,20 @@ class FileDownloadTest extends FileTestCase { // Set file downloads to private so handler functions get called. // Create a file. - $file = $this->createFile(NULL, NULL, 'private'); + $contents = $this->randomName(8); + $file = $this->createFile(NULL, $contents, 'private'); $url = file_create_url($file->uri); // Set file_test access header to allow the download. file_test_set_return('download', array('x-foo' => 'Bar')); - $this->drupalHead($url); + $this->drupalGet($url); $headers = $this->drupalGetHeaders(); - $this->assertEqual($headers['x-foo'] , 'Bar', t('Found header set by file_test module on private download.')); + $this->assertEqual($headers['x-foo'], 'Bar', t('Found header set by file_test module on private download.')); $this->assertResponse(200, t('Correctly allowed access to a file when file_test provides headers.')); + // Test that the file transfered correctly. + $this->assertEqual($contents, $this->content, t('Contents of the file are correct.')); + // Deny access to all downloads via a -1 header. file_test_set_return('download', -1); $this->drupalHead($url); @@ -2475,7 +2487,7 @@ class FileMimeTypeTest extends DrupalWebTestCase { * Test mapping of mimetypes from filenames. */ public function testFileMimeTypeDetection() { - $prefix = 'simpletest://'; + $prefix = 'public://'; $test_case = array( 'test.jar' => 'application/java-archive', diff --git a/modules/simpletest/tests/file_test.module b/modules/simpletest/tests/file_test.module index 2865a1f..c75385c 100644 --- a/modules/simpletest/tests/file_test.module +++ b/modules/simpletest/tests/file_test.module @@ -133,7 +133,7 @@ function _file_test_form_submit(&$form, &$form_state) { /** * Reset/initialize the history of calls to the file_* hooks. * - * @see file_test_get_calls() + * @see file_test_get_calls() * @see file_test_reset() */ function file_test_reset() { diff --git a/modules/system/system.module b/modules/system/system.module index 21b23f4..47e0d32 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -3411,12 +3411,12 @@ function system_image_toolkits() { function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $replace = FILE_EXISTS_RENAME) { $parsed_url = parse_url($url); if (!isset($destination)) { - $path = file_build_uri(basename($parsed_url['path'])); + $path = file_build_uri(drupal_basename($parsed_url['path'])); } else { if (is_dir(drupal_realpath($destination))) { // Prevent URIs with triple slashes when glueing parts together. - $path = str_replace('///', '//', "$destination/") . basename($parsed_url['path']); + $path = str_replace('///', '//', "$destination/") . drupal_basename($parsed_url['path']); } else { $path = $destination; diff --git a/modules/system/system.test b/modules/system/system.test index 583dd6d..e4eae9a 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -1955,7 +1955,7 @@ class RetrieveFileTestCase extends DrupalWebTestCase { function testFileRetrieving() { // Test 404 handling by trying to fetch a randomly named file. drupal_mkdir($sourcedir = 'public://' . $this->randomName()); - $filename = $this->randomName(); + $filename = 'Файл для тестирования ' . $this->randomName(); $url = file_create_url($sourcedir . '/' . $filename); $retrieved_file = system_retrieve_file($url); $this->assertFalse($retrieved_file, t('Non-existent file not fetched.')); @@ -1963,7 +1963,12 @@ class RetrieveFileTestCase extends DrupalWebTestCase { // Actually create that file, download it via HTTP and test the returned path. file_put_contents($sourcedir . '/' . $filename, 'testing'); $retrieved_file = system_retrieve_file($url); - $this->assertEqual($retrieved_file, 'public://' . $filename, t('Sane path for downloaded file returned (public:// scheme).')); + + // URLs could not contains characters outside the ASCII set so $filename + // has to be encoded. + $encoded_filename = rawurlencode($filename); + + $this->assertEqual($retrieved_file, 'public://' . $encoded_filename, t('Sane path for downloaded file returned (public:// scheme).')); $this->assertTrue(is_file($retrieved_file), t('Downloaded file does exist (public:// scheme).')); $this->assertEqual(filesize($retrieved_file), 7, t('File size of downloaded file is correct (public:// scheme).')); file_unmanaged_delete($retrieved_file); @@ -1971,7 +1976,7 @@ class RetrieveFileTestCase extends DrupalWebTestCase { // Test downloading file to a different location. drupal_mkdir($targetdir = 'temporary://' . $this->randomName()); $retrieved_file = system_retrieve_file($url, $targetdir); - $this->assertEqual($retrieved_file, "$targetdir/$filename", t('Sane path for downloaded file returned (temporary:// scheme).')); + $this->assertEqual($retrieved_file, "$targetdir/$encoded_filename", t('Sane path for downloaded file returned (temporary:// scheme).')); $this->assertTrue(is_file($retrieved_file), t('Downloaded file does exist (temporary:// scheme).')); $this->assertEqual(filesize($retrieved_file), 7, t('File size of downloaded file is correct (temporary:// scheme).')); file_unmanaged_delete($retrieved_file); diff --git a/modules/update/update.manager.inc b/modules/update/update.manager.inc index b0def17..d8e0711 100644 --- a/modules/update/update.manager.inc +++ b/modules/update/update.manager.inc @@ -830,7 +830,7 @@ function update_manager_file_get($url) { // Check the cache and download the file if needed. $cache_directory = 'temporary://update-cache'; - $local = $cache_directory . '/' . basename($parsed_url['path']); + $local = $cache_directory . '/' . drupal_basename($parsed_url['path']); if (!file_exists($cache_directory)) { mkdir($cache_directory); diff --git a/modules/update/update.module b/modules/update/update.module index 1008964..c474cf7 100644 --- a/modules/update/update.module +++ b/modules/update/update.module @@ -694,14 +694,14 @@ function update_verify_update_archive($project, $archive_file, $directory) { } if (empty($files)) { - $errors[] = t('%archive_file does not contain any .info files.', array('%archive_file' => basename($archive_file))); + $errors[] = t('%archive_file does not contain any .info files.', array('%archive_file' => drupal_basename($archive_file))); } elseif (!$compatible_project) { $errors[] = format_plural( count($incompatible), '%archive_file contains a version of %names that is not compatible with Drupal !version.', '%archive_file contains versions of modules or themes that are not compatible with Drupal !version: %names', - array('!version' => DRUPAL_CORE_COMPATIBILITY, '%archive_file' => basename($archive_file), '%names' => implode(', ', $incompatible)) + array('!version' => DRUPAL_CORE_COMPATIBILITY, '%archive_file' => drupal_basename($archive_file), '%names' => implode(', ', $incompatible)) ); }