Skip to content

Commit b4bc3ef

Browse files
committed
Update to 1.21.0
2 parents af7ce75 + 17e21ea commit b4bc3ef

File tree

301 files changed

+3183
-1656
lines changed

Some content is hidden

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

301 files changed

+3183
-1656
lines changed

.github/misc/settings.local.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
/**
3+
* @file
4+
* Disable sending of telemetry data from GitHub Action runners.
5+
* @see .github/workflows/functional-tests.yml
6+
*/
7+
8+
$settings['telemetry_enabled'] = FALSE;

.github/workflows/functional-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ jobs:
6060
curl -sI 'http://localhost/'
6161
6262
- name: Install Backdrop
63-
run: core/scripts/install.sh --db-url=mysql://root:[email protected]/backdrop
63+
run: |
64+
cp ./.github/misc/settings.local.php .
65+
core/scripts/install.sh --db-url=mysql://root:[email protected]/backdrop
6466
6567
- name: Run tests
6668
run: |

.tugboat/settings.local.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@
1010
// Trusted hosts.
1111
$settings['trusted_host_patterns'] = array('^.+\.tugboat\.qa$');
1212

13+
// Disable sending Telemetry data on cron runs.
14+
$settings['telemetry_enabled'] = FALSE;
15+
1316
// Miscellaneous.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,14 @@ project:
8080

8181
User Guide
8282
----------
83-
Please see the the [Backdrop Handbook](https://docs.backdropcms.org/documentation/getting-started).
83+
Please see the [Backdrop Handbook](https://docs.backdropcms.org/documentation/getting-started).
8484

8585
Developer Documentation
8686
-----------------------
87-
Please see the the [Backdrop API Documentation](https://docs.backdropcms.org/api/backdrop/groups).
87+
Please see the [Backdrop API Documentation](https://docs.backdropcms.org/api/backdrop/groups).
8888

8989
Code of Conduct
9090
---------------
91-
9291
A primary goal of the Backdrop CMS community is to be inclusive to the largest
9392
number of contributors, with the most varied and diverse backgrounds possible.
9493
As such, we are committed to providing a friendly, safe and welcoming
@@ -110,7 +109,7 @@ Backdrop is [GPL v2](http://www.gnu.org/licenses/gpl-2.0.html) (or higher)
110109
software. See the LICENSE.txt file for complete text. Distributions of this
111110
software may relicense it as any later version of the GPL.
112111

113-
All Backdrop code is Copyright 2001 - 2021 by the original authors.
112+
All Backdrop code is Copyright 2001 - 2022 by the original authors.
114113

115114
Backdrop also includes works under different copyright notices that are
116115
distributed according to the terms of the GNU General Public License or a

core/includes/ajax.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ function ajax_form_callback() {
428428
* administration theme. Depending on whether the "Use the administration theme
429429
* when editing or creating content" checkbox is checked, the node edit form may
430430
* be displayed in either theme, but the Ajax response to the Field module's
431-
* "Add another item" button should be rendered using the same theme as the rest
432-
* of the page. Therefore, system_menu() sets the 'theme callback' for
431+
* "Add another" button should be rendered using the same theme as the rest of
432+
* the page. Therefore, system_menu() sets the 'theme callback' for
433433
* 'system/ajax' to this function, and it is recommended that modules
434434
* implementing other generic Ajax paths do the same.
435435
*

core/includes/bootstrap.inc

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* The current system version.
99
*/
10-
define('BACKDROP_VERSION', '1.20.3');
10+
define('BACKDROP_VERSION', '1.21.0');
1111

1212
/**
1313
* Core API compatibility.
@@ -3224,26 +3224,30 @@ function _backdrop_bootstrap_page_header() {
32243224
*/
32253225
function _backdrop_bootstrap_sanitize_request() {
32263226
// Remove dangerous keys from input data.
3227-
$whitelist = settings_get('sanitize_input_whitelist', array());
3227+
$allowlist = settings_get('sanitize_input_allowlist', array());
3228+
if (empty($allowlist)) {
3229+
// Backwards compatible setting support. @todo Remove in 2.x.
3230+
$allowlist = settings_get('sanitize_input_whitelist', array());
3231+
}
32283232
$log_sanitized_keys = settings_get('sanitize_input_logging');
32293233

32303234
// Process query string parameters.
3231-
$sanitized_keys = _backdrop_bootstrap_sanitize_input($_GET, $whitelist);
3235+
$sanitized_keys = _backdrop_bootstrap_sanitize_input($_GET, $allowlist);
32323236
if ($sanitized_keys && $log_sanitized_keys) {
32333237
trigger_error(format_string('Potentially unsafe keys removed from query string parameters (GET): @keys', array('@keys' => implode(', ', $sanitized_keys))), E_USER_WARNING);
32343238
}
32353239
// Process request body parameters.
3236-
$sanitized_keys = _backdrop_bootstrap_sanitize_input($_POST, $whitelist);
3240+
$sanitized_keys = _backdrop_bootstrap_sanitize_input($_POST, $allowlist);
32373241
if ($sanitized_keys && $log_sanitized_keys) {
32383242
trigger_error(format_string('Potentially unsafe keys removed from request body parameters (POST): @keys', array('@keys' => implode(', ', $sanitized_keys))), E_USER_WARNING);
32393243
}
32403244
// Process cookie parameters.
3241-
$sanitized_keys = _backdrop_bootstrap_sanitize_input($_COOKIE, $whitelist);
3245+
$sanitized_keys = _backdrop_bootstrap_sanitize_input($_COOKIE, $allowlist);
32423246
if ($sanitized_keys && $log_sanitized_keys) {
32433247
trigger_error(format_string('Potentially unsafe keys removed from cookie parameters (COOKIE): @keys', array('@keys' => implode(', ', $sanitized_keys))), E_USER_WARNING);
32443248
}
32453249
// Process request global. No need to log; already logged in $_GET and $_POST.
3246-
_backdrop_bootstrap_sanitize_input($_REQUEST, $whitelist);
3250+
_backdrop_bootstrap_sanitize_input($_REQUEST, $allowlist);
32473251

32483252
// Sanitize the destination parameter (which is often used for redirects) to
32493253
// prevent open redirect attacks leading to other domains. Sanitize both
@@ -3269,7 +3273,7 @@ function _backdrop_bootstrap_sanitize_request() {
32693273
}
32703274

32713275
if (!empty($destination_parts['query'])) {
3272-
$sanitized_keys = _backdrop_bootstrap_sanitize_input($destination_parts['query'], $whitelist);
3276+
$sanitized_keys = _backdrop_bootstrap_sanitize_input($destination_parts['query'], $allowlist);
32733277
}
32743278

32753279
if ($sanitized_keys) {
@@ -3287,23 +3291,23 @@ function _backdrop_bootstrap_sanitize_request() {
32873291
*
32883292
* @param mixed $input
32893293
* The input data array from a request to be sanitized.
3290-
* @param string[] $whitelist
3291-
* Whitelist of input keys that are considered acceptable.
3294+
* @param string[] $allowlist
3295+
* Allowed list of input keys that are considered acceptable.
32923296
*
32933297
* @return string[]
32943298
* The list of any input keys have been filtered out, if any.
32953299
*/
3296-
function _backdrop_bootstrap_sanitize_input(&$input, $whitelist = array()) {
3300+
function _backdrop_bootstrap_sanitize_input(&$input, $allowlist = array()) {
32973301
$sanitized_keys = array();
32983302

32993303
if (is_array($input)) {
33003304
foreach ($input as $key => $value) {
3301-
if ($key !== '' && substr($key, 0, 1) === '#' && !in_array($key, $whitelist, TRUE)) {
3305+
if ($key !== '' && substr($key, 0, 1) === '#' && !in_array($key, $allowlist, TRUE)) {
33023306
unset($input[$key]);
33033307
$sanitized_keys[] = $key;
33043308
}
33053309
elseif (is_array($input[$key])) {
3306-
$sanitized_keys = array_merge($sanitized_keys, _backdrop_bootstrap_sanitize_input($input[$key], $whitelist));
3310+
$sanitized_keys = array_merge($sanitized_keys, _backdrop_bootstrap_sanitize_input($input[$key], $allowlist));
33073311
}
33083312
}
33093313
}
@@ -3702,7 +3706,7 @@ function language_default() {
37023706
* - http://example.com/node/306 returns "node/306".
37033707
* - http://example.com/backdropfolder/node/306 returns "node/306" while
37043708
* base_path() returns "/backdropfolder/".
3705-
* - http://example.com/path/alias (which is a path alias for node/306) returns
3709+
* - http://example.com/url-alias (which is a URL alias for node/306) returns
37063710
* "path/alias" as opposed to the internal path.
37073711
* - http://example.com/index.php returns an empty string (meaning: home page).
37083712
* - http://example.com/index.php?page=1 returns an empty string.

core/includes/common.inc

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,7 @@ function filter_xss($string, $allowed_tags = NULL) {
18341834

18351835
// Defuse all HTML entities.
18361836
$string = str_replace('&', '&amp;', $string);
1837-
// Change back only well-formed entities in our whitelist:
1837+
// Change back only well-formed entities in our allowlist:
18381838
// Decimal numeric entities.
18391839
$string = preg_replace('/&amp;#([0-9]+;)/', '&#\1', $string);
18401840
// Hexadecimal numeric entities.
@@ -2544,7 +2544,7 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) {
25442544
* arguments for internal paths must be supplied in $options['query'], not
25452545
* included in $path.
25462546
* - If you provide an internal path and $options['alias'] is set to TRUE, the
2547-
* path is assumed already to be the correct path alias, and the alias is
2547+
* path is assumed already to be the correct URL alias, and the alias is
25482548
* not looked up.
25492549
* - The special string '<front>' generates a link to the site's base URL.
25502550
* - If your external URL contains a query (e.g. http://example.com/foo?a=b),
@@ -2678,7 +2678,7 @@ function url($path = NULL, array $options = array()) {
26782678
$langcode = isset($options['language']) && isset($options['language']->langcode) ? $options['language']->langcode : '';
26792679
$alias = backdrop_get_path_alias($original_path, $langcode);
26802680
if ($alias != $original_path) {
2681-
// Strip leading slashes from internal path aliases to prevent them
2681+
// Strip leading slashes from internal URL aliases to prevent them
26822682
// becoming external URLs without protocol. /example.com should not be
26832683
// turned into //example.com.
26842684
$path = ltrim($alias, '/');
@@ -2814,7 +2814,7 @@ function backdrop_http_header_attributes(array $attributes = array()) {
28142814
* // will return an onmouseout attribute with JavaScript code that, when used
28152815
* // as attribute in a tag, will cause users to be redirected to another site.
28162816
* //
2817-
* // In this case, the 'onmouseout' attribute should not be whitelisted --
2817+
* // In this case, the 'onmouseout' attribute should not be allowed --
28182818
* // you don't want users to have the ability to add this attribute or others
28192819
* // that take JavaScript commands.
28202820
* backdrop_attributes(array('onmouseout' => 'window.location="http://malicious.com/";')));
@@ -7814,7 +7814,7 @@ function backdrop_common_theme() {
78147814
'variables' => array('type' => MARK_NEW),
78157815
),
78167816
'item_list' => array(
7817-
'variables' => array('items' => array(), 'title' => '', 'type' => 'ul', 'attributes' => array()),
7817+
'variables' => array('items' => array(), 'title' => '', 'type' => 'ul', 'attributes' => array(), 'empty' => NULL),
78187818
),
78197819
'more_help_link' => array(
78207820
'variables' => array('url' => NULL),
@@ -8665,12 +8665,13 @@ function backdrop_parse_dependency($dependency) {
86658665
$p_major = '(?P<major>\d+)';
86668666
// By setting the minor version to x, branches can be matched.
86678667
$p_minor = '(?P<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?)';
8668+
$p_patch = '(?P<patch>(?:\d+|x)(?:-[A-Za-z]+\d+)?)?';
86688669
$parts = explode('(', $dependency, 2);
86698670
$value['name'] = trim($parts[0]);
86708671
if (isset($parts[1])) {
86718672
$value['original_version'] = '(' . $parts[1];
86728673
foreach (explode(',', $parts[1]) as $version) {
8673-
if (preg_match("/^\s*$p_op\s*$p_core$p_major\.$p_minor/", $version, $matches)) {
8674+
if (preg_match("/^\s*$p_op\s*$p_core$p_major\.$p_minor\.?$p_patch/", $version, $matches)) {
86748675
$op = !empty($matches['operation']) ? $matches['operation'] : '=';
86758676
if ($matches['minor'] == 'x') {
86768677
// Backdrop considers "2.x" to mean any version that begins with
@@ -8688,7 +8689,23 @@ function backdrop_parse_dependency($dependency) {
86888689
$op = '>=';
86898690
}
86908691
}
8691-
$value['versions'][] = array('op' => $op, 'version' => $matches['major'] . '.' . $matches['minor']);
8692+
8693+
if (isset($matches['patch']) && ($matches['patch'] === '0' || $matches['patch'])) {
8694+
if ($matches['patch'] == 'x' && $matches['minor'] !== 'x') {
8695+
// See comments above about "x" in minor.
8696+
// Same principle applies to patch in relation to minor.
8697+
if ($op == '>' || $op == '<=') {
8698+
$matches['minor']++;
8699+
}
8700+
if ($op == '=' || $op == '==') {
8701+
$value['versions'][] = array('op' => '<', 'version' => $matches['major'] . '.' . ($matches['minor'] + 1) . '.x');
8702+
$op = '>=';
8703+
}
8704+
}
8705+
}
8706+
$version = $matches['major'] . '.' . $matches['minor'];
8707+
$version .= (isset($matches['patch']) && ($matches['patch'] === '0' || $matches['patch'])) ? '.' . $matches['patch'] : '';
8708+
$value['versions'][] = array('op' => $op, 'version' => $version);
86928709
}
86938710
}
86948711
}
@@ -8726,12 +8743,18 @@ function backdrop_check_incompatibility(array $dependency_info, $current_version
87268743
* Converts a Backdrop version string into numeric-only version string.
87278744
*
87288745
* @param string $version_string
8729-
* A version string such as 1.10.0-beta4 or 1.4.x-dev.
8746+
* A version string such as 1.x-1.2.3, 1.10.0-beta4, or 1.4.x-dev.
87308747
* @return string
87318748
* A converted string only containing numbers, for use in PHP's
87328749
* version_compare() function.
87338750
*/
87348751
function _backdrop_version_compare_convert($version_string) {
8752+
// Remove the "1.x-" prefix (indicating Backdrop core version compatibility).
8753+
$core_prefix = BACKDROP_CORE_COMPATIBILITY . '-';
8754+
if (strpos($version_string, $core_prefix) === 0) {
8755+
$version_string = substr($version_string, strlen($core_prefix));
8756+
}
8757+
87358758
// Convert "dev" releases to be the highest possible version number. For
87368759
// example 1.5.x-dev should be considered higher than any other 1.5 release,
87378760
// so we replace .x with 99999.

core/includes/drupal.inc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ function drupal_get_path_alias($path = NULL, $langcode = NULL) {
21752175
}
21762176

21772177
/**
2178-
* Given a path alias, return the internal path it represents.
2178+
* Given a URL alias, return the internal path it represents.
21792179
*
21802180
* @deprecated since 1.0.0
21812181
* @see backdrop_get_normal_path()
@@ -2208,7 +2208,7 @@ function drupal_match_path($path, $patterns) {
22082208
}
22092209

22102210
/**
2211-
* Rebuild the path alias white list.
2211+
* Rebuild the URL alias allowlist.
22122212
*
22132213
* @deprecated since 1.0.0
22142214
*/
@@ -2217,6 +2217,16 @@ function drupal_path_alias_whitelist_rebuild($source = NULL) {
22172217
return array();
22182218
}
22192219

2220+
/**
2221+
* Rebuild the path alias allowlist.
2222+
*
2223+
* @deprecated since 1.21.0
2224+
*/
2225+
function drupal_path_alias_allowlist_rebuild($source = NULL) {
2226+
watchdog_deprecated_function('drupal', __FUNCTION__);
2227+
return drupal_path_alias_whitelist_rebuild();
2228+
}
2229+
22202230
/**
22212231
* Checks a path exists and the current user has access to it.
22222232
*

core/includes/errors.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ function _backdrop_log_error($error, $fatal = FALSE) {
270270
*/
271271
function _backdrop_get_last_caller($backtrace) {
272272
// Errors that occur inside PHP internal functions do not generate
273-
// information about file and line. Ignore black listed functions.
274-
$blacklist = array('debug', '_backdrop_error_handler', '_backdrop_exception_handler');
273+
// information about file and line. Ignore disallowed functions.
274+
$denylist = array('debug', '_backdrop_error_handler', '_backdrop_exception_handler');
275275
while (($backtrace && !isset($backtrace[0]['line'])) ||
276-
(isset($backtrace[1]['function']) && in_array($backtrace[1]['function'], $blacklist))) {
276+
(isset($backtrace[1]['function']) && in_array($backtrace[1]['function'], $denylist))) {
277277
array_shift($backtrace);
278278
}
279279

core/includes/file.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,11 +1228,11 @@ function file_munge_filename($filename, $extensions, $alerts = TRUE) {
12281228
// Remove any null bytes. See http://php.net/manual/security.filesystem.nullbytes.php
12291229
$filename = str_replace(chr(0), '', $filename);
12301230

1231-
$whitelist = array_unique(explode(' ', strtolower(trim($extensions))));
1231+
$allowlist = array_unique(explode(' ', strtolower(trim($extensions))));
12321232

12331233
// Remove unsafe extensions from the list of allowed extensions. The list is
12341234
// copied from file_save_upload().
1235-
$whitelist = array_diff($whitelist, explode('|', 'php|phar|pl|py|cgi|asp|js'));
1235+
$allowlist = array_diff($allowlist, explode('|', 'php|phar|pl|py|cgi|asp|js'));
12361236

12371237
// Split the filename up by periods. The first part becomes the basename
12381238
// the last part the final extension.
@@ -1245,7 +1245,7 @@ function file_munge_filename($filename, $extensions, $alerts = TRUE) {
12451245
// of allowed extensions.
12461246
foreach ($filename_parts as $filename_part) {
12471247
$new_filename .= '.' . $filename_part;
1248-
if (!in_array(strtolower($filename_part), $whitelist) && preg_match("/^[a-zA-Z]{2,5}\d?$/", $filename_part)) {
1248+
if (!in_array(strtolower($filename_part), $allowlist) && preg_match("/^[a-zA-Z]{2,5}\d?$/", $filename_part)) {
12491249
$new_filename .= '_';
12501250
}
12511251
}

0 commit comments

Comments
 (0)