Skip to content

Commit

Permalink
Issue #2054205 by pfrenssen, Berdir: Broken Tests on PHP 5.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidRothstein committed Dec 30, 2013
1 parent f362e6a commit 001532a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

Drupal 7.25, xxxx-xx-xx (development version)
-----------------------
- Fixed broken tests on PHP 5.5.
- Made the File and Image modules more robust when saving entities that have
deleted files attached. The code in file_field_presave() will now remove the
record of the deleted file from the entity before saving (minor data
Expand Down
18 changes: 17 additions & 1 deletion modules/simpletest/drupal_web_test_case.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,15 @@ public function errorHandler($severity, $message, $file = NULL, $line = NULL) {
E_RECOVERABLE_ERROR => 'Recoverable error',
);

// PHP 5.3 adds new error logging constants. Add these conditionally for
// backwards compatibility with PHP 5.2.
if (defined('E_DEPRECATED')) {
$error_map += array(
E_DEPRECATED => 'Deprecated',
E_USER_DEPRECATED => 'User deprecated',
);
}

$backtrace = debug_backtrace();
$this->error($message, $error_map[$severity], _drupal_get_last_caller($backtrace));
}
Expand Down Expand Up @@ -2046,7 +2055,14 @@ protected function drupalPost($path, $edit, $submit, array $options = array(), a
foreach ($upload as $key => $file) {
$file = drupal_realpath($file);
if ($file && is_file($file)) {
$post[$key] = '@' . $file;
// Use the new CurlFile class for file uploads when using PHP
// 5.5 or higher.
if (class_exists('CurlFile')) {
$post[$key] = curl_file_create($file);
}
else {
$post[$key] = '@' . $file;
}
}
}
}
Expand Down

0 comments on commit 001532a

Please sign in to comment.