Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.208 diff -u -9 -p -r1.208 file.inc --- includes/file.inc 30 Apr 2010 01:33:17 -0000 1.208 +++ includes/file.inc 9 May 2010 17:21:39 -0000 @@ -561,32 +561,32 @@ function file_save(stdClass $file) { * * @see file_unmanaged_copy() * @see hook_file_copy() */ function file_copy(stdClass $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) { if ($uri = file_unmanaged_copy($source->uri, $destination, $replace)) { $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)); if (count($existing_files)) { $existing = reset($existing_files); $file->fid = $existing->fid; $file->filename = $existing->filename; } } // 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); // Inform modules that the file has been copied. module_invoke_all('file_copy', $file, $source); return $file; } @@ -628,31 +628,31 @@ function file_unmanaged_copy($source, $d $source = drupal_realpath($source); if (!file_exists($source)) { // @todo Replace drupal_set_message() calls with exceptions instead. drupal_set_message(t('The specified file %file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.', array('%file' => $original_source)), 'error'); return FALSE; } // Build a destination URI if necessary. if (!isset($destination)) { - $destination = file_build_uri(basename($source)); + $destination = file_build_uri(drupal_basename($source)); } // Assert that the destination contains a valid stream. $destination_scheme = file_uri_scheme($destination); if (!$destination_scheme || !file_stream_wrapper_valid_scheme($destination_scheme)) { drupal_set_message(t('The specified file %file could not be copied, because the destination %destination is invalid. This is often caused by improper use of file_unmanaged_copy() or a missing stream wrapper.', array('%file' => $original_source, '%destination' => $destination)), 'error'); } // 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? $dirname = drupal_dirname($destination); if (!file_prepare_directory($dirname)) { // The destination is not valid. drupal_set_message(t('The specified file %file could not be copied, because the destination %directory is not properly configured. This is often caused by a problem with file or directory permissions.', array('%file' => $original_source, '%directory' => $destination)), 'error'); return FALSE; } @@ -710,19 +710,19 @@ function file_build_uri($path) { */ function file_destination($destination, $replace) { if (file_exists($destination)) { switch ($replace) { case FILE_EXISTS_REPLACE: // Do nothing here, we want to overwrite the existing file. break; case FILE_EXISTS_RENAME: - $basename = basename($destination); + $basename = drupal_basename($destination); $directory = drupal_dirname($destination); $destination = file_create_filename($basename, $directory); break; case FILE_EXISTS_ERROR: // Error reporting handled by calling function. return FALSE; } } @@ -774,19 +774,19 @@ function file_move(stdClass $source, $de if (count($existing_files)) { $existing = reset($existing_files); $delete_source = TRUE; $file->fid = $existing->fid; } } // 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); // Inform modules that the file has been moved. module_invoke_all('file_move', $file, $source); if ($delete_source) { // Try a soft delete to remove original if it's not in use elsewhere. @@ -1161,19 +1161,19 @@ function file_save_upload($source, $vali foreach ($user->roles as $rid => $name) { $extensions .= ' ' . variable_get("upload_extensions_$rid", variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp')); } // Begin building file object. $file = new stdClass(); $file->uid = $user->uid; $file->status = 0; - $file->filename = file_munge_filename(trim(basename($_FILES['files']['name'][$source]), '.'), $extensions); + $file->filename = file_munge_filename(trim(drupal_basename($_FILES['files']['name'][$source]), '.'), $extensions); $file->uri = $_FILES['files']['tmp_name'][$source]; $file->filemime = file_get_mimetype($file->filename); $file->filesize = $_FILES['files']['size'][$source]; // Rename potentially executable files, to help prevent exploits. if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) && (substr($file->filename, -4) != '.txt')) { $file->filemime = 'text/plain'; $file->uri .= '.txt'; $file->filename .= '.txt'; @@ -1472,35 +1472,35 @@ function file_validate_image_resolution( */ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAME) { global $user; if ($uri = file_unmanaged_save_data($data, $destination, $replace)) { // Create a file object. $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; // 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)); if (count($existing_files)) { $existing = reset($existing_files); $file->fid = $existing->fid; $file->filename = $existing->filename; } } // 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); } return FALSE; } /** * Save a string to the specified destination without invoking file API. @@ -1877,18 +1877,44 @@ function drupal_dirname($uri) { return $scheme . '://' . $dirname; } else { return 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; + } + if (file_uri_scheme($uri)) { + $uri = file_uri_target($uri); + } + $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 * is not provided, this function will make sure that Drupal's is used. * * Compatibility: normal paths and stream wrappers. * @see http://drupal.org/node/515192 * * @param $uri @@ -1943,19 +1969,19 @@ function drupal_mkdir($uri, $mode = NULL * @ingroup php_wrappers */ function drupal_tempnam($directory, $prefix) { $scheme = file_uri_scheme($directory); if ($scheme && file_stream_wrapper_valid_scheme($scheme)) { $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; } } else { // Handle as a normal tempnam() call. return tempnam($directory, $prefix); } Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.254 diff -u -9 -p -r1.254 locale.inc --- includes/locale.inc 1 May 2010 08:12:22 -0000 1.254 +++ includes/locale.inc 9 May 2010 17:21:39 -0000 @@ -1947,19 +1947,19 @@ function _locale_batch_build($files, $fi * @param $filepath * Path to a file to import. * @param $results * Contains a list of files imported. */ 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; } } /** * Finished callback of system page locale import batch. * Inform the user of translation files imported. */ Index: includes/stream_wrappers.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/stream_wrappers.inc,v retrieving revision 1.14 diff -u -9 -p -r1.14 stream_wrappers.inc --- includes/stream_wrappers.inc 30 Apr 2010 01:33:17 -0000 1.14 +++ includes/stream_wrappers.inc 9 May 2010 17:21:39 -0000 @@ -253,19 +253,19 @@ abstract class DrupalLocalStreamWrapper static function getMimeType($uri, $mapping = NULL) { if (!isset($mapping)) { // The default file map, defined in file.mimetypes.inc is quite big. // We only load it when necessary. include_once DRUPAL_ROOT . '/includes/file.mimetypes.inc'; $mapping = file_mimetype_mapping(); } $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); // Iterate over the file parts, trying to find a match. // For my.awesome.image.jpeg, we try: // - jpeg // - image.jpeg, and // - awesome.image.jpeg @@ -301,19 +301,19 @@ abstract class DrupalLocalStreamWrapper */ protected function getLocalPath($uri = NULL) { if (!isset($uri)) { $uri = $this->uri; } $path = $this->getDirectoryPath() . '/' . file_uri_target($uri); $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) { return FALSE; } return $realpath; } /** Index: includes/updater.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/updater.inc,v retrieving revision 1.5 diff -u -9 -p -r1.5 updater.inc --- includes/updater.inc 30 Jan 2010 07:54:01 -0000 1.5 +++ includes/updater.inc 9 May 2010 17:21:39 -0000 @@ -132,19 +132,19 @@ class Updater { * @return string * Path to the info file. */ public static function findInfoFile($directory) { $info_files = file_scan_directory($directory, '/.*\.info/'); if (!$info_files) { 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; } } // Otherwise, return the first one. $info_file = array_shift($info_files); return $info_file->uri; } @@ -152,19 +152,19 @@ class Updater { * Get the name of the project directory (basename). * * @todo: It would be nice, if projects contained an info file which could * provide their canonical name. * * @param string $directory * @return string */ public static function getProjectName($directory) { - return basename($directory); + return drupal_basename($directory); } /** * Return the project name from a Drupal info file. * * @param string $directory * Directory to search for the info file. * @return string */ Index: includes/filetransfer/filetransfer.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/filetransfer/filetransfer.inc,v retrieving revision 1.9 diff -u -9 -p -r1.9 filetransfer.inc --- includes/filetransfer/filetransfer.inc 11 Apr 2010 18:33:43 -0000 1.9 +++ includes/filetransfer/filetransfer.inc 9 May 2010 17:21:39 -0000 @@ -199,19 +199,19 @@ abstract class FileTransfer { * We need a separate method to make the $destination is in the jail. * * @param $source * The source path. * @param $destination * The destination path. */ 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 RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST) as $filename => $file) { $relative_path = substr($filename, strlen($source)); if ($file->isDir()) { $this->createDirectory($destination . $relative_path); } else { $this->copyFile($file->getPathName(), $destination . $relative_path); Index: modules/file/tests/file.test =================================================================== RCS file: /cvs/drupal/drupal/modules/file/tests/file.test,v retrieving revision 1.14 diff -u -9 -p -r1.14 file.test --- modules/file/tests/file.test 20 Apr 2010 09:48:06 -0000 1.14 +++ modules/file/tests/file.test 9 May 2010 17:21:39 -0000 @@ -95,19 +95,19 @@ class FileFieldTestCase extends DrupalWe ); if (is_numeric($nid_or_type)) { $node = node_load($nid_or_type); $delta = isset($node->$field_name) ? count($node->$field_name) : 0; $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_' . $delta . ']'] = realpath($file->uri); $this->drupalPost('node/' . $nid_or_type . '/edit', $edit, t('Save')); } else { - $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'] = realpath($file->uri); + $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'] = drupal_realpath($file->uri); $type_name = str_replace('_', '-', $nid_or_type); $this->drupalPost('node/add/' . $type_name, $edit, t('Save')); } $matches = array(); preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches); return isset($matches[1]) ? $matches[1] : FALSE; } @@ -305,27 +305,29 @@ class FileFieldDisplayTestCase extends F ); $instance_settings = array( 'description_field' => '1', ); $widget_settings = array(); $this->createFileField($field_name, $type_name, $field_settings, $instance_settings, $widget_settings); $field = field_info_field($field_name); $instance = field_info_instance('node', $field_name, $type_name); - $test_file = $this->getTestFile('text'); + // Use a test file beginning with a non-US-ASCII character + $test_file = file_copy($this->getTestFile('text'), 'temporary://é & stuff.txt'); // Create a new node with the uploaded file. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); $this->drupalGet('node/' . $nid . '/edit'); // Check that the default formatter is displaying with the file name. $node = node_load($nid, NULL, TRUE); $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0]; + $this->assertEqual('é & stuff.txt', $node_file->filename, t('File was uploaded with expected filename.')); $default_output = theme('file_link', array('file' => $node_file)); $this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.')); // Turn the "display" option off and check that the file is no longer displayed. $edit = array($field_name . '[' . LANGUAGE_NONE . '][0][display]' => FALSE); $this->drupalPost('node/' . $nid . '/edit', $edit, t('Save')); $this->assertNoRaw($default_output, t('Field is hidden when "display" option is unchecked.')); Index: modules/image/image.test =================================================================== RCS file: /cvs/drupal/drupal/modules/image/image.test,v retrieving revision 1.21 diff -u -9 -p -r1.21 image.test --- modules/image/image.test 1 May 2010 08:12:23 -0000 1.21 +++ modules/image/image.test 9 May 2010 17:21:40 -0000 @@ -172,21 +172,21 @@ class ImageStylesPathAndUrlUnitTest exte // Create a working copy of the file. $files = $this->drupalGetTestFiles('image'); $file = reset($files); $image_info = image_get_info($file->uri); $original_uri = file_unmanaged_copy($file->uri, $scheme . '://', FILE_EXISTS_RENAME); $this->assertNotIdentical(FALSE, $original_uri, t('Created the generated image file.')); // Get the URL of a file that has not been generated yet and try to access // it before image_style_url has been called. - $generated_uri = $scheme . '://styles/' . $this->style_name . '/' . basename($original_uri); + $generated_uri = $scheme . '://styles/' . $this->style_name . '/' . drupal_basename($original_uri); $this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.')); - $expected_generate_url = url('image/generate/' . $this->style_name . '/' . $scheme . '/' . basename($original_uri), array('absolute' => TRUE)); + $expected_generate_url = url('image/generate/' . $this->style_name . '/' . $scheme . '/' . drupal_basename($original_uri), array('absolute' => TRUE)); $this->drupalGet($expected_generate_url); $this->assertResponse(403, t('Access to generate URL was denied.')); // Check that a generate URL is returned. $actual_generate_url = image_style_url($this->style_name, $original_uri); $this->assertEqual($actual_generate_url, $expected_generate_url, t('Got the generate URL for a non-existent file.')); // Fetch the URL that generates the file while another process appears to // be generating the same file (this is signaled using a lock). Index: modules/simpletest/tests/file.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/file.test,v retrieving revision 1.53 diff -u -9 -p -r1.53 file.test --- modules/simpletest/tests/file.test 11 Apr 2010 18:33:44 -0000 1.53 +++ modules/simpletest/tests/file.test 9 May 2010 17:21:40 -0000 @@ -180,19 +180,19 @@ class FileTestCase extends DrupalWebTest if (is_null($contents)) { $contents = "file_put_contents() doesn't seem to appreciate empty strings so let's put in some data."; } file_put_contents($filepath, $contents); $this->assertTrue(is_file($filepath), t('The test file exists on the disk.'), 'Create test file'); $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; $file->filesize = filesize($file->uri); $file->status = 0; // Write the record directly rather than calling file_save() so we don't // invoke the hooks. $this->assertNotIdentical(drupal_write_record('file_managed', $file), FALSE, t('The file was added to the database.'), 'Create test file'); @@ -349,23 +349,23 @@ class FileValidatorTest extends DrupalWe 'group' => 'File API', ); } function setUp() { parent::setUp(); $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); } /** * Test the file_validate_extensions() function. */ function testFileValidateExtensions() { $file = new stdClass(); $file->filename = 'asdf.txt'; $errors = file_validate_extensions($file, 'asdf txt pork'); @@ -518,19 +518,19 @@ class FileUnmanagedSaveDataTest extends $filepath = file_unmanaged_save_data($contents); $this->assertTrue($filepath, t('Unnamed file saved correctly.')); $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($filepath)), t("File was placed in Drupal's files directory.")); $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), t('Contents of the file are correct.')); // 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(file_directory_path('public'), file_directory_path(file_uri_scheme($filepath)), t("File was placed in Drupal's files directory.")); - $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)); } } /** * Test the file_save_upload() function. */ class FileSaveUploadTest extends FileHookTestCase { @@ -618,19 +618,19 @@ class FileSaveUploadTest extends FileHoo $image3_realpath = drupal_realpath($image3->uri); $dir = $this->randomName(); $edit = array( 'files[file_test_upload]' => $image3_realpath, 'file_subdir' => $dir, ); $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.')); } /** * Test renaming when uploading over a file that already exists. */ function testExistingRename() { @@ -1759,19 +1759,19 @@ class FileSaveDataTest extends FileHookT * Test the file_save_data() function when no filename is provided. */ function testWithoutFilename() { $contents = $this->randomName(8); $result = file_save_data($contents); $this->assertTrue($result, t('Unnamed file saved correctly.')); $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_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.")); // Check that the correct hooks were called. $this->assertFileHooksCalled(array('insert')); // Verify that what was returned is what's in the database. $this->assertFileUnchanged($result, file_load($result->fid, TRUE)); @@ -1781,19 +1781,19 @@ class FileSaveDataTest extends FileHookT * Test the file_save_data() function when a filename is provided. */ function testWithFilename() { $contents = $this->randomName(8); $result = file_save_data($contents, 'public://' . 'asdf.txt'); $this->assertTrue($result, t('Unnamed file saved correctly.')); $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_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('asdf.txt', 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.")); // Check that the correct hooks were called. $this->assertFileHooksCalled(array('insert')); // Verify that what was returned is what's in the database. $this->assertFileUnchanged($result, file_load($result->fid, TRUE)); Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.926 diff -u -9 -p -r1.926 system.module --- modules/system/system.module 30 Apr 2010 01:33:17 -0000 1.926 +++ modules/system/system.module 9 May 2010 17:21:41 -0000 @@ -3219,24 +3219,24 @@ function system_image_toolkits() { * unique. * - FILE_EXISTS_ERROR: Do nothing and return FALSE. * * @return * On success the location the file was saved to, FALSE on failure. */ 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; } } $result = drupal_http_request($url); if ($result->code != 200) { drupal_set_message(t('HTTP error @errorcode occurred when trying to fetch @remote.', array('@errorcode' => $result->code, '@remote' => $url)), 'error'); return FALSE; Index: modules/update/update.manager.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.manager.inc,v retrieving revision 1.21 diff -u -9 -p -r1.21 update.manager.inc --- modules/update/update.manager.inc 24 Apr 2010 14:49:14 -0000 1.21 +++ modules/update/update.manager.inc 9 May 2010 17:21:41 -0000 @@ -702,19 +702,19 @@ function update_manager_archive_verify($ function update_manager_file_get($url) { $parsed_url = parse_url($url); $remote_schemes = array('http', 'https', 'ftp', 'ftps', 'smb', 'nfs'); if (!in_array($parsed_url['scheme'], $remote_schemes)) { // This is a local file, just return the path. return drupal_realpath($url); } // Check the cache and download the file if needed. - $local = 'temporary://update-cache/' . basename($parsed_url['path']); + $local = 'temporary://update-cache/' . drupal_basename($parsed_url['path']); $cache_directory = DRUPAL_ROOT . '/' . file_directory_path('temporary') . '/update-cache/'; if (!file_exists($cache_directory)) { mkdir($cache_directory); } if (!file_exists($local)) { return system_retrieve_file($url, $local); } Index: modules/user/user.install =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.install,v retrieving revision 1.45 diff -u -9 -p -r1.45 user.install --- modules/user/user.install 13 Apr 2010 15:15:07 -0000 1.45 +++ modules/user/user.install 9 May 2010 17:21:41 -0000 @@ -511,19 +511,19 @@ function user_update_7004(&$sandbox) { // Check if the file already exists. $files = file_load_multiple(array(), array('uri' => $user->picture)); if (count($files)) { $file = reset($files); } else { // Create a file object. $file = new stdClass(); $file->uri = $user->picture; - $file->filename = basename($file->uri); + $file->filename = drupal_basename($file->uri); $file->filemime = file_get_mimetype($file->uri); $file->uid = $user->uid; $file->status = FILE_STATUS_PERMANENT; $file = file_save($file); } db_update('users') ->fields(array('picture_fid' => $file->fid)) ->condition('uid', $user->uid)