Commit 4237d014 authored by webchick's avatar webchick

#874326 by rfay, pwolanin, chx: Fixed Invalid scheme fails to halt processing of a stream request.

parent d5a1c652
......@@ -814,7 +814,7 @@ public function escapeField($field) {
*
* Force all alias names to be strictly alphanumeric-plus-underscore. In
* contrast to DatabaseConnection::escapeField() /
* DatabaseConnection::escapeTable(), this doesn't allow the period (".")
* DatabaseConnection::escapeTable(), this doesn't allow the period (".")
*
* @return
* The sanitized field name string.
......
This diff is collapsed.
......@@ -116,11 +116,11 @@ class FileFieldTestCase extends DrupalWebTestCase {
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);
$edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_' . $delta . ']'] = drupal_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'));
}
......@@ -149,7 +149,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
*/
function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
$edit = array(
'files[' . $field_name . '_' . LANGUAGE_NONE . '_0]' => realpath($file->uri),
'files[' . $field_name . '_' . LANGUAGE_NONE . '_0]' => drupal_realpath($file->uri),
'revision' => (string) (int) $new_revision,
);
......@@ -336,7 +336,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
// Add a comment with a file.
$text_file = $this->getTestFile('text');
$edit = array(
'files[field_' . $name . '_' . LANGUAGE_NONE . '_' . 0 . ']' => realpath($text_file->uri),
'files[field_' . $name . '_' . LANGUAGE_NONE . '_' . 0 . ']' => drupal_realpath($text_file->uri),
'comment_body[' . LANGUAGE_NONE . '][0][value]' => $comment_body = $this->randomName(),
);
$this->drupalPost(NULL, $edit, t('Save'));
......@@ -566,6 +566,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
// Create a new node with the uploaded file.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$this->assertTrue($nid !== FALSE, t('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', array('@test_file' => $test_file->uri, '@field_name' => $field_name, '@type_name' => $type_name)));
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
......
......@@ -94,7 +94,7 @@ class ImageFieldTestCase extends DrupalWebTestCase {
$edit = array(
'title' => $this->randomName(),
);
$edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'] = realpath($image->uri);
$edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'] = drupal_realpath($image->uri);
$this->drupalPost('node/add/' . $type, $edit, t('Save'));
// Retrieve ID of the newly created node from the current URL.
......@@ -786,7 +786,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
// Add a default image to the imagefield instance.
$images = $this->drupalGetTestFiles('image');
$edit = array(
'files[field_settings_default_image]' => realpath($images[0]->uri),
'files[field_settings_default_image]' => drupal_realpath($images[0]->uri),
);
$this->drupalPost('admin/structure/types/manage/article/fields/' . $field_name, $edit, t('Save settings'));
// Clear field info cache so the new default image is detected.
......
......@@ -939,7 +939,7 @@ protected function drupalGetTestFiles($type, $size = NULL) {
$files = array();
// Make sure type is valid.
if (in_array($type, array('binary', 'html', 'image', 'javascript', 'php', 'sql', 'text'))) {
$files = file_scan_directory(variable_get('file_public_path', conf_path() . '/files'), '/' . $type . '\-.*/');
$files = file_scan_directory('public://', '/' . $type . '\-.*/');
// If size is set then remove any files that are not of that size.
if ($size !== NULL) {
......
......@@ -575,7 +575,9 @@ class FileSaveUploadTest extends FileHookTestCase {
$account = $this->drupalCreateUser(array('access content'));
$this->drupalLogin($account);
$this->image = current($this->drupalGetTestFiles('image'));
$image_files = $this->drupalGetTestFiles('image');
$this->image = current($image_files);
list(, $this->image_extension) = explode('.', $this->image->filename);
$this->assertTrue(is_file($this->image->uri), t("The image file we're going to upload exists."));
......
......@@ -1299,13 +1299,14 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
function testThemeSettings() {
// Specify a filesystem path to be used for the logo.
$file = current($this->drupalGetTestFiles('image'));
$fullpath = drupal_realpath($file->uri);
$edit = array(
'default_logo' => FALSE,
'logo_path' => $file->uri,
'logo_path' => $fullpath,
);
$this->drupalPost('admin/appearance/settings', $edit, t('Save configuration'));
$this->drupalGet('node');
$this->assertRaw($file->uri, t('Logo path successfully changed.'));
$this->assertRaw($fullpath, t('Logo path successfully changed.'));
// Upload a file to use for the logo.
$file = current($this->drupalGetTestFiles('image'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment