Skip to content
This repository was archived by the owner on Aug 14, 2023. It is now read-only.

Commit 1d29936

Browse files
committed
SERV-234: Updated drupal core, link and metatag module
1 parent 9d1ac80 commit 1d29936

File tree

375 files changed

+5575
-1579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

375 files changed

+5575
-1579
lines changed

CHANGELOG.txt

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
Drupal 7.xx, xxxx-xx-xx (development version)
2+
-----------------------
3+
4+
Drupal 7.64, 2019-02-06
5+
-----------------------
6+
- [regression] Unset the 'host' header in drupal_http_request() during redirect
7+
- Fixed: 7.x does not have Phar protection and Phar tests are failing on Drupal 7
8+
- Fixed: Notice: Undefined index: display_field in file_field_widget_value() (line 582 of /module/file/file.field.inc)
9+
- Performance improvement: Registry rebuild should not parse the same file twice in the same request
10+
- Fixed _registry_update() to clear caches after transaction is committed
11+
12+
Drupal 7.63, 2019-01-16
13+
-----------------------
14+
- Fixed a fatal error for some Drush users introduced by SA-CORE-2019-002.
15+
16+
Drupal 7.62, 2019-01-15
17+
-----------------------
18+
- Fixed security issues:
19+
- SA-CORE-2019-001
20+
- SA-CORE-2019-002
21+
22+
Drupal 7.61, 2018-11-07
23+
-----------------------
24+
- File upload validation functions and hook_file_validate() implementations are
25+
now always passed the correct file URI.
26+
- The default form cache expiration of 6 hours is now configurable (API
27+
addition: https://www.drupal.org/node/2857751).
28+
- Allowed callers of drupal_http_request() to optionally specify an explicit
29+
Host header.
30+
- Allowed the + character to appear in usernames.
31+
- PHP 7.2: Fixed Archive_Tar incompatibility.
32+
- PHP 7.2: Removed deprecated function each().
33+
- PHP 7.2: Avoid count() calls on uncountable variables.
34+
- PHP 7.2: Removed deprecated create_function() call.
35+
- PHP 7.2: Make sure variables are arrays in theme_links().
36+
- Fixed theme-settings.php not being loaded on cached forms
37+
- Fixed problem with IE11 & Chrome(PointerEvents enabled) & some Firefox scroll to the top of the page after dragging the bottom item with jquery 1.5 <-> 1.11
38+
139
Drupal 7.60, 2018-10-18
240
------------------------
341
- Fixed security issues. See SA-CORE-2018-006.
@@ -8,7 +46,7 @@ Drupal 7.59, 2018-04-25
846

947
Drupal 7.58, 2018-03-28
1048
-----------------------
11-
- Fixed security issues (multiple vulnerabilities). See SA-CORE-2018-002.
49+
- Fixed security issues (remote code execution). See SA-CORE-2018-002.
1250

1351
Drupal 7.57, 2018-02-21
1452
-----------------------

MAINTAINERS.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The branch maintainers for Drupal 7 are:
1515
- Fabian Franz 'Fabianx' https://www.drupal.org/u/fabianx
1616
- David Rothstein 'David_Rothstein' https://www.drupal.org/u/david_rothstein
1717
- Stefan Ruijsenaars 'stefan.r' https://www.drupal.org/u/stefanr-0
18+
- (provisional) Pol Dellaiera 'Pol' https://www.drupal.org/u/pol
1819

1920

2021
Component maintainers
@@ -44,10 +45,9 @@ Cron system
4445
- Derek Wright 'dww' https://www.drupal.org/u/dww
4546

4647
Database system
47-
- Larry Garfield 'Crell' https://www.drupal.org/u/crell
48+
- ?
4849

4950
- MySQL driver
50-
- Larry Garfield 'Crell' https://www.drupal.org/u/crell
5151
- David Strauss 'David Strauss' https://www.drupal.org/u/david-strauss
5252

5353
- PostgreSQL driver

includes/bootstrap.inc

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* The current system version.
1010
*/
11-
define('VERSION', '7.60');
11+
define('VERSION', '7.64');
1212

1313
/**
1414
* Core API compatibility.
@@ -704,6 +704,19 @@ function drupal_environment_initialize() {
704704
// Set sane locale settings, to ensure consistent string, dates, times and
705705
// numbers handling.
706706
setlocale(LC_ALL, 'C');
707+
708+
// PHP's built-in phar:// stream wrapper is not sufficiently secure. Override
709+
// it with a more secure one, which requires PHP 5.3.3. For lower versions,
710+
// unregister the built-in one without replacing it. Sites needing phar
711+
// support for lower PHP versions must implement hook_stream_wrappers() to
712+
// register their desired implementation.
713+
if (in_array('phar', stream_get_wrappers(), TRUE)) {
714+
stream_wrapper_unregister('phar');
715+
if (version_compare(PHP_VERSION, '5.3.3', '>=')) {
716+
include_once DRUPAL_ROOT . '/includes/file.phar.inc';
717+
file_register_phar_wrapper();
718+
}
719+
}
707720
}
708721

709722
/**
@@ -3785,8 +3798,12 @@ function _drupal_shutdown_function() {
37853798
chdir(DRUPAL_ROOT);
37863799

37873800
try {
3788-
while (list($key, $callback) = each($callbacks)) {
3801+
// Manually iterate over the array instead of using a foreach loop.
3802+
// A foreach operates on a copy of the array, so any shutdown functions that
3803+
// were added from other shutdown functions would never be called.
3804+
while ($callback = current($callbacks)) {
37893805
call_user_func_array($callback['callback'], $callback['arguments']);
3806+
next($callbacks);
37903807
}
37913808
}
37923809
catch (Exception $exception) {

includes/common.inc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,10 @@ function drupal_http_request($url, array $options = array()) {
867867
// Make the socket connection to a proxy server.
868868
$socket = 'tcp://' . $proxy_server . ':' . variable_get('proxy_port', 8080);
869869
// The Host header still needs to match the real request.
870-
$options['headers']['Host'] = $uri['host'];
871-
$options['headers']['Host'] .= isset($uri['port']) && $uri['port'] != 80 ? ':' . $uri['port'] : '';
870+
if (!isset($options['headers']['Host'])) {
871+
$options['headers']['Host'] = $uri['host'];
872+
$options['headers']['Host'] .= isset($uri['port']) && $uri['port'] != 80 ? ':' . $uri['port'] : '';
873+
}
872874
break;
873875

874876
case 'http':
@@ -878,14 +880,18 @@ function drupal_http_request($url, array $options = array()) {
878880
// RFC 2616: "non-standard ports MUST, default ports MAY be included".
879881
// We don't add the standard port to prevent from breaking rewrite rules
880882
// checking the host that do not take into account the port number.
881-
$options['headers']['Host'] = $uri['host'] . ($port != 80 ? ':' . $port : '');
883+
if (!isset($options['headers']['Host'])) {
884+
$options['headers']['Host'] = $uri['host'] . ($port != 80 ? ':' . $port : '');
885+
}
882886
break;
883887

884888
case 'https':
885889
// Note: Only works when PHP is compiled with OpenSSL support.
886890
$port = isset($uri['port']) ? $uri['port'] : 443;
887891
$socket = 'ssl://' . $uri['host'] . ':' . $port;
888-
$options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : '');
892+
if (!isset($options['headers']['Host'])) {
893+
$options['headers']['Host'] = $uri['host'] . ($port != 443 ? ':' . $port : '');
894+
}
889895
break;
890896

891897
default:
@@ -1088,6 +1094,11 @@ function drupal_http_request($url, array $options = array()) {
10881094
elseif ($options['max_redirects']) {
10891095
// Redirect to the new location.
10901096
$options['max_redirects']--;
1097+
1098+
// We need to unset the 'Host' header
1099+
// as we are redirecting to a new location.
1100+
unset($options['headers']['Host']);
1101+
10911102
$result = drupal_http_request($location, $options);
10921103
$result->redirect_code = $code;
10931104
}

includes/file.inc

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,9 +1534,9 @@ function file_save_upload($form_field_name, $validators = array(), $destination
15341534
// rename filename.php.foo and filename.php to filename.php.foo.txt and
15351535
// filename.php.txt, respectively). Don't rename if 'allow_insecure_uploads'
15361536
// evaluates to TRUE.
1537-
if (!variable_get('allow_insecure_uploads', 0) && preg_match('/\.(php|pl|py|cgi|asp|js)(\.|$)/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
1537+
if (!variable_get('allow_insecure_uploads', 0) && preg_match('/\.(php|phar|pl|py|cgi|asp|js)(\.|$)/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
15381538
$file->filemime = 'text/plain';
1539-
$file->uri .= '.txt';
1539+
// The destination filename will also later be used to create the URI.
15401540
$file->filename .= '.txt';
15411541
// The .txt extension may not be in the allowed list of extensions. We have
15421542
// to add it here or else the file upload will fail.
@@ -2130,9 +2130,33 @@ function file_download_access($uri) {
21302130
* 'filename', and 'name' members corresponding to the matching files.
21312131
*/
21322132
function file_scan_directory($dir, $mask, $options = array(), $depth = 0) {
2133+
// Default nomask option.
2134+
$nomask = '/(\.\.?|CVS)$/';
2135+
2136+
// Overrides the $nomask variable accordingly if $options['nomask'] is set.
2137+
//
2138+
// Allow directories specified in settings.php to be ignored. You can use this
2139+
// to not check for files in common special-purpose directories. For example,
2140+
// node_modules and bower_components. Ignoring irrelevant directories is a
2141+
// performance boost.
2142+
if (!isset($options['nomask'])) {
2143+
$ignore_directories = variable_get(
2144+
'file_scan_ignore_directories',
2145+
array()
2146+
);
2147+
2148+
foreach ($ignore_directories as $index => $ignore_directory) {
2149+
$ignore_directories[$index] = preg_quote($ignore_directory, '/');
2150+
}
2151+
2152+
if (!empty($ignore_directories)) {
2153+
$nomask = '/^(\.\.?)|CVS|' . implode('|', $ignore_directories) . '$/';
2154+
}
2155+
}
2156+
21332157
// Merge in defaults.
21342158
$options += array(
2135-
'nomask' => '/(\.\.?|CVS)$/',
2159+
'nomask' => $nomask,
21362160
'callback' => 0,
21372161
'recurse' => TRUE,
21382162
'key' => 'uri',

includes/file.phar.inc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
use Drupal\Core\Security\PharExtensionInterceptor;
4+
use TYPO3\PharStreamWrapper\Manager as PharStreamWrapperManager;
5+
use TYPO3\PharStreamWrapper\Behavior as PharStreamWrapperBehavior;
6+
use TYPO3\PharStreamWrapper\PharStreamWrapper;
7+
8+
/**
9+
* Registers a phar stream wrapper that is more secure than PHP's built-in one.
10+
*
11+
* @see file_get_stream_wrappers()
12+
*/
13+
function file_register_phar_wrapper() {
14+
$directory = DRUPAL_ROOT . '/misc/typo3/phar-stream-wrapper/src';
15+
include_once $directory . '/Assertable.php';
16+
include_once $directory . '/Behavior.php';
17+
include_once $directory . '/Exception.php';
18+
include_once $directory . '/Helper.php';
19+
include_once $directory . '/Manager.php';
20+
include_once $directory . '/PharStreamWrapper.php';
21+
include_once DRUPAL_ROOT . '/misc/typo3/drupal-security/PharExtensionInterceptor.php';
22+
23+
// Set up a stream wrapper to handle insecurities due to PHP's built-in
24+
// phar stream wrapper.
25+
try {
26+
$behavior = new PharStreamWrapperBehavior();
27+
PharStreamWrapperManager::initialize(
28+
$behavior->withAssertion(new PharExtensionInterceptor())
29+
);
30+
}
31+
catch (\LogicException $e) {
32+
// Continue if the PharStreamWrapperManager is already initialized.
33+
// For example, this occurs following a drupal_static_reset(), such
34+
// as during tests.
35+
};
36+
37+
// To prevent file_stream_wrapper_valid_scheme() treating "phar" as a valid
38+
// scheme, this is registered with PHP only, not with hook_stream_wrappers()
39+
// or the internal storage of file_get_stream_wrappers().
40+
stream_wrapper_register('phar', '\\TYPO3\\PharStreamWrapper\\PharStreamWrapper');
41+
}

includes/form.inc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,10 @@ function form_get_cache($form_build_id, &$form_state) {
555555
* Stores a form in the cache.
556556
*/
557557
function form_set_cache($form_build_id, $form, $form_state) {
558-
// 6 hours cache life time for forms should be plenty.
559-
$expire = 21600;
558+
// The default cache_form expiration is 6 hours. On busy sites, the cache_form
559+
// table can become very large. A shorter cache lifetime can help to keep the
560+
// table's size under control.
561+
$expire = variable_get('form_cache_expiration', 21600);
560562

561563
// Ensure that the form build_id embedded in the form structure is the same as
562564
// the one passed in as a parameter. This is an additional safety measure to
@@ -1438,10 +1440,12 @@ function _form_validate(&$elements, &$form_state, $form_id = NULL) {
14381440
// length if it's a string, and the item count if it's an array.
14391441
// An unchecked checkbox has a #value of integer 0, different than string
14401442
// '0', which could be a valid value.
1441-
$is_empty_multiple = (!count($elements['#value']));
1443+
$is_countable = is_array($elements['#value']) || $elements['#value'] instanceof Countable;
1444+
$is_empty_multiple = $is_countable && count($elements['#value']) == 0;
14421445
$is_empty_string = (is_string($elements['#value']) && drupal_strlen(trim($elements['#value'])) == 0);
14431446
$is_empty_value = ($elements['#value'] === 0);
1444-
if ($is_empty_multiple || $is_empty_string || $is_empty_value) {
1447+
$is_empty_null = is_null($elements['#value']);
1448+
if ($is_empty_multiple || $is_empty_string || $is_empty_value || $is_empty_null) {
14451449
// Although discouraged, a #title is not mandatory for form elements. In
14461450
// case there is no #title, we cannot set a form error message.
14471451
// Instead of setting no #title, form constructors are encouraged to set

includes/install.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ function drupal_uninstall_modules($module_list = array(), $uninstall_dependents
779779
$module_list = array_flip(array_values($module_list));
780780

781781
$profile = drupal_get_profile();
782-
while (list($module) = each($module_list)) {
782+
foreach (array_keys($module_list) as $module) {
783783
if (!isset($module_data[$module]) || drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) {
784784
// This module doesn't exist or is already uninstalled. Skip it.
785785
unset($module_list[$module]);

includes/menu.inc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ function _menu_load_objects(&$item, &$map) {
576576
// 'load arguments' in the hook_menu() entry, but they need
577577
// some processing. In this case the $function is the key to the
578578
// load_function array, and the value is the list of arguments.
579-
list($function, $args) = each($function);
579+
$args = current($function);
580+
$function = key($function);
580581
$load_functions[$index] = $function;
581582

582583
// Some arguments are placeholders for dynamic items to process.
@@ -2402,7 +2403,8 @@ function menu_set_active_trail($new_trail = NULL) {
24022403
// a stripped down menu tree containing the active trail only, in case
24032404
// the given menu has not been built in this request yet.
24042405
$tree = menu_tree_page_data($preferred_link['menu_name'], NULL, TRUE);
2405-
list($key, $curr) = each($tree);
2406+
$curr = current($tree);
2407+
next($tree);
24062408
}
24072409
// There is no link for the current path.
24082410
else {
@@ -2432,7 +2434,8 @@ function menu_set_active_trail($new_trail = NULL) {
24322434
}
24332435
$tree = $curr['below'] ? $curr['below'] : array();
24342436
}
2435-
list($key, $curr) = each($tree);
2437+
$curr = current($tree);
2438+
next($tree);
24362439
}
24372440
// Make sure the current page is in the trail to build the page title, by
24382441
// appending either the preferred link or the menu router item for the

includes/module.inc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,11 @@ function module_enable($module_list, $enable_dependencies = TRUE) {
404404
// Create an associative array with weights as values.
405405
$module_list = array_flip(array_values($module_list));
406406

407-
while (list($module) = each($module_list)) {
407+
// The array is iterated over manually (instead of using a foreach) because
408+
// modules may be added to the list within the loop and we need to process
409+
// them.
410+
while ($module = key($module_list)) {
411+
next($module_list);
408412
if (!isset($module_data[$module])) {
409413
// This module is not found in the filesystem, abort.
410414
return FALSE;
@@ -540,7 +544,11 @@ function module_disable($module_list, $disable_dependents = TRUE) {
540544
$module_list = array_flip(array_values($module_list));
541545

542546
$profile = drupal_get_profile();
543-
while (list($module) = each($module_list)) {
547+
// The array is iterated over manually (instead of using a foreach) because
548+
// modules may be added to the list within the loop and we need to process
549+
// them.
550+
while ($module = key($module_list)) {
551+
next($module_list);
544552
if (!isset($module_data[$module]) || !$module_data[$module]->status) {
545553
// This module doesn't exist or is already disabled, skip it.
546554
unset($module_list[$module]);

0 commit comments

Comments
 (0)