Skip to content

Commit d86a945

Browse files
authored
Backdrop 1.29.2 (#60)
1 parent 7d24ba2 commit d86a945

File tree

243 files changed

+807
-690
lines changed

Some content is hidden

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

243 files changed

+807
-690
lines changed

docroot/core/includes/bootstrap.classes.inc

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ function backdrop_class_list() {
7676
'DatabaseStatementEmpty' => $path . 'database/database.inc',
7777
'DatabaseStatementInterface' => $path . 'database/database.inc',
7878
'DatabaseLog' => $path . 'database/log.inc',
79-
'DatabaseStatementPrefetch' => $path . 'database/prefetch.inc',
79+
// @todo Remove DatabaseStatementPrefetch entirely, only used by SQLite.
80+
// 'DatabaseStatementPrefetch' => $path . 'database/prefetch.inc',
8081
'Query' => $path . 'database/query.inc',
8182
'InsertQuery' => $path . 'database/query.inc',
8283
'DeleteQuery' => $path . 'database/query.inc',

docroot/core/includes/bootstrap.inc

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* The current system version.
99
*/
10-
define('BACKDROP_VERSION', '1.29.0');
10+
define('BACKDROP_VERSION', '1.29.2');
1111

1212
/**
1313
* Core API compatibility.
@@ -469,6 +469,9 @@ abstract class BackdropCacheArray implements ArrayAccess {
469469
* Destructs the BackdropCacheArray object.
470470
*/
471471
public function __destruct() {
472+
if (!is_array($this->keysToPersist)) {
473+
throw new UnexpectedValueException();
474+
}
472475
$data = array();
473476
foreach ($this->keysToPersist as $offset => $persist) {
474477
if ($persist) {

docroot/core/includes/database/mysql/query.inc

+9
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ class InsertQuery_mysql extends InsertQuery {
6262

6363
$max_placeholder = 0;
6464
$values = array();
65+
if (!is_array($this->insertValues)) {
66+
// Older PHP versions cannot throw an exception within __toString().
67+
if (version_compare(PHP_VERSION, '7.4', '>=')) {
68+
throw new UnexpectedValueException();
69+
}
70+
else {
71+
trigger_error('Unexpected Value');
72+
}
73+
}
6574
if (count($this->insertValues)) {
6675
foreach ($this->insertValues as $insert_values) {
6776
$placeholders = array();

docroot/core/includes/database/prefetch.inc

+7
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,13 @@ class DatabaseStatementPrefetch implements Iterator, DatabaseStatementInterface
286286
$class_name = $this->fetchOptions['class'];
287287
}
288288
if (count($this->fetchOptions['constructor_args'])) {
289+
// Verify the current db connection to avoid this code being called
290+
// in an inappropriate context.
291+
$db_connection_options = Database::getConnection()->getConnectionOptions();
292+
$valid_db_drivers = array('sqlite', 'oracle');
293+
if (!in_array($db_connection_options['driver'], $valid_db_drivers)) {
294+
throw new BadMethodCallException();
295+
}
289296
$reflector = new ReflectionClass($class_name);
290297
$result = $reflector->newInstanceArgs($this->fetchOptions['constructor_args']);
291298
}

docroot/core/includes/database/query.inc

+10
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,16 @@ class UpdateQuery extends Query implements QueryConditionInterface {
12001200
* The prepared statement.
12011201
*/
12021202
public function __toString() {
1203+
// Older PHP versions cannot throw an exception in __toString().
1204+
if (!is_array($this->expressionFields) || !is_array($this->fields)) {
1205+
if (version_compare(PHP_VERSION, '7.4', '>=')) {
1206+
throw new UnexpectedValueException();
1207+
}
1208+
else {
1209+
trigger_error('Unexpected Value');
1210+
}
1211+
}
1212+
12031213
// Create a sanitized comment string to prepend to the query.
12041214
$comments = $this->connection->makeComment($this->comments);
12051215

docroot/core/includes/file.inc

+8-5
Original file line numberDiff line numberDiff line change
@@ -2038,6 +2038,9 @@ function file_validate_svg(File $file) {
20382038

20392039
if ($file->filemime == 'image/svg+xml') {
20402040
$file_contents = file_get_contents($file->uri);
2041+
$file_contents = preg_replace('/<!DOCTYPE[^>]*>/i', '', $file_contents);
2042+
$file_contents = html_entity_decode($file_contents);
2043+
$file_contents = strtolower($file_contents);
20412044
libxml_use_internal_errors(TRUE);
20422045
$xml = simplexml_load_string($file_contents);
20432046
$errors = libxml_get_errors();
@@ -2054,15 +2057,15 @@ function file_validate_svg(File $file) {
20542057

20552058
$search_patterns = array(
20562059
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element
2057-
'//svg:foreignObject',
2060+
'//svg:foreignobject',
20582061
'//svg:script',
20592062
'//html:iframe',
20602063
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
20612064
'//@*[starts-with(name(), "on")]',
2062-
'//svg:a[starts-with(@href, "javascript:")]',
2063-
'//svg:a[starts-with(@xlink:href, "javascript:")]',
2064-
'//svg:a[starts-with(@href, "data:")]',
2065-
'//svg:a[starts-with(@xlink:href, "data:")]',
2065+
'//svg:a[starts-with(normalize-space(@href), "javascript:")]',
2066+
'//svg:a[starts-with(normalize-space(@xlink:href), "javascript:")]',
2067+
'//svg:a[starts-with(normalize-space(@href), "data:")]',
2068+
'//svg:a[starts-with(normalize-space(@xlink:href), "data:")]',
20662069
);
20672070

20682071
$xml->registerXPathNamespace('svg', 'http://www.w3.org/2000/svg');

docroot/core/includes/icon.inc

+2-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ function icon_get_info($icon_name = NULL) {
282282
* - attributes: Attributes to be added to the icon itself.
283283
*
284284
* @return string
285-
* The HTML output.
285+
* The HTML output. An empty string if the icon file is not svg.
286286
*
287287
* @since 1.28.0 Function added.
288288
* @since 1.28.1 The <ellipse>, <line>, <polygon> and <polyline> SVG elements
@@ -340,4 +340,5 @@ function theme_icon(array $variables) {
340340
return image_add_svg_attributes($svg_contents, $variables['attributes']);
341341
}
342342
}
343+
return '';
343344
}

docroot/core/includes/image.inc

+23-14
Original file line numberDiff line numberDiff line change
@@ -577,30 +577,39 @@ function image_is_svg($uri) {
577577
* which is the accessible mechanism for alternative text within SVGs.
578578
*
579579
* @return string
580-
* The SVG image contents with the attributes added.
580+
* The SVG image contents with the attributes added. An empty string in case
581+
* of errors.
581582
*
582583
* @since 1.28.0 Function added.
583584
*/
584585
function image_add_svg_attributes($svg_content, array $attributes) {
585586
$doc = new DOMDocument();
587+
libxml_use_internal_errors(TRUE);
586588
$doc->loadXML($svg_content);
587589
$svg_tag = $doc->getElementsByTagName('svg')->item(0);
590+
$last_error = libxml_get_last_error();
591+
libxml_use_internal_errors(FALSE);
592+
if (empty($svg_tag)) {
593+
$message = $last_error ? trim($last_error->message) : '';
594+
watchdog('image', 'Failed to parse SVG content. %message', array(
595+
'%message' => $message,
596+
), WATCHDOG_ERROR);
597+
return '';
598+
}
588599

589600
// Convert the alt attribute to a <title> element.
590601
if (isset($attributes['alt'])) {
591-
try {
592-
if (strlen($attributes['alt'])) {
593-
$title = $doc->createElement('title');
594-
$title->textContent = $attributes['alt'];
595-
// Since DOMDocument::prepend() is not available in PHP versions prior
596-
// to v8, we are using DOMNode::insertBefore().
597-
$svg_tag->insertBefore($title, $svg_tag->firstChild);
598-
}
599-
// Remove any given <title> element if alt is an empty string.
600-
elseif ($svg_tag->firstChild && $svg_tag->firstChild->nodeName === 'title') {
601-
$svg_tag->removeChild($svg_tag->firstChild);
602-
}
603-
} catch (DOMException $e) {}
602+
if (strlen($attributes['alt'])) {
603+
$title = $doc->createElement('title');
604+
$title->textContent = $attributes['alt'];
605+
// Since DOMDocument::prepend() is not available in PHP versions prior
606+
// to v8, we are using DOMNode::insertBefore().
607+
$svg_tag->insertBefore($title, $svg_tag->firstChild);
608+
}
609+
// Remove any given <title> element if alt is an empty string.
610+
elseif ($svg_tag->firstChild && $svg_tag->firstChild->nodeName === 'title') {
611+
$svg_tag->removeChild($svg_tag->firstChild);
612+
}
604613
unset($attributes['alt']);
605614
}
606615

docroot/core/includes/install.core.inc

+19-7
Original file line numberDiff line numberDiff line change
@@ -1616,13 +1616,12 @@ function install_check_translation_download($langcode) {
16161616
}
16171617

16181618
$version = BACKDROP_VERSION;
1619+
$fallback_version = BACKDROP_CORE_COMPATIBILITY;
16191620

1620-
// For dev releases, remove the '-dev' part and trust the translation server
1621-
// to fall back to the latest stable release for that branch.
1622-
// @see locale_translation_build_projects()
1623-
if (preg_match("/^(\d+\.).*-(dev|preview)$/", $version, $matches)) {
1624-
// Example match: 1.28-dev => 1.x (Backdrop core).
1625-
$version = $matches[1] . 'x';
1621+
// Get major and minor version, ignore any irrelevant dev or preview addition.
1622+
if (preg_match("/^(\d+)\.(\d+)/", $version, $matches)) {
1623+
$version = $matches[0];
1624+
$fallback_version = $matches[1] . '.x';
16261625
}
16271626

16281627
// Build URL for the translation file and the translation server.
@@ -1633,6 +1632,9 @@ function install_check_translation_download($langcode) {
16331632
'%language' => $langcode,
16341633
);
16351634
$translation_url = strtr(INSTALL_LOCALIZATION_SERVER_PATTERN, $variables);
1635+
// Also build a generic fallback URL.
1636+
$variables['%version'] = $fallback_version;
1637+
$fallback_url = strtr(INSTALL_LOCALIZATION_SERVER_PATTERN, $variables);
16361638

16371639
$elements = parse_url($translation_url);
16381640
$server_url = $elements['scheme'] . '://' . $elements['host'];
@@ -1650,7 +1652,17 @@ function install_check_translation_download($langcode) {
16501652
$online = TRUE;
16511653
}
16521654
if ($online) {
1653-
$translation_available = install_check_localization_server($translation_url);
1655+
// We have to start with the fallback URL, otherwise the static cache
1656+
// already returns FALSE.
1657+
$translation_available = install_check_localization_server($fallback_url);
1658+
if ($translation_available) {
1659+
// Look up the version specific translation file. We can not rely on its
1660+
// existence, as generation happens manually after release.
1661+
// If it does not exist, yet, we stick with the generic fallback.
1662+
if (!install_check_localization_server($translation_url)) {
1663+
$translation_url = $fallback_url;
1664+
}
1665+
}
16541666
}
16551667

16561668
// If the translations directory does not exist, throw an error.

docroot/core/layouts/boxton/boxton.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ preview = boxton.png
2525
; Include the Bootstrap4 Grid System
2626
libraries[] = bootstrap4-gs
2727

28-
; Added by Backdrop CMS packaging script on 2024-09-15
28+
; Added by Backdrop CMS packaging script on 2024-11-20
2929
project = backdrop
30-
version = 1.29.0
31-
timestamp = 1726467067
30+
version = 1.29.2
31+
timestamp = 1732142640

docroot/core/layouts/geary/geary.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ preview = geary.png
2727
; Include the Bootstrap4 Grid System
2828
libraries[] = bootstrap4-gs
2929

30-
; Added by Backdrop CMS packaging script on 2024-09-15
30+
; Added by Backdrop CMS packaging script on 2024-11-20
3131
project = backdrop
32-
version = 1.29.0
33-
timestamp = 1726467067
32+
version = 1.29.2
33+
timestamp = 1732142640

docroot/core/layouts/harris/harris.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ preview = harris.png
2727
; Include the Bootstrap4 Grid System
2828
libraries[] = bootstrap4-gs
2929

30-
; Added by Backdrop CMS packaging script on 2024-09-15
30+
; Added by Backdrop CMS packaging script on 2024-11-20
3131
project = backdrop
32-
version = 1.29.0
33-
timestamp = 1726467067
32+
version = 1.29.2
33+
timestamp = 1732142640

docroot/core/layouts/legacy/one_column/one_column.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ regions[footer] = Footer
1818
; Modify this line if you would like to change the default in this layout.
1919
default region = content
2020

21-
; Added by Backdrop CMS packaging script on 2024-09-15
21+
; Added by Backdrop CMS packaging script on 2024-11-20
2222
project = backdrop
23-
version = 1.29.0
24-
timestamp = 1726467067
23+
version = 1.29.2
24+
timestamp = 1732142640

docroot/core/layouts/legacy/three_three_four_column/three_three_four_column.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ regions[footer] = Footer bottom
2626
; Modify this line if you would like to change the default in this layout.
2727
default region = content
2828

29-
; Added by Backdrop CMS packaging script on 2024-09-15
29+
; Added by Backdrop CMS packaging script on 2024-11-20
3030
project = backdrop
31-
version = 1.29.0
32-
timestamp = 1726467067
31+
version = 1.29.2
32+
timestamp = 1732142640

docroot/core/layouts/legacy/two_column/two_column.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ regions[footer] = Footer
1515
; Modify this line if you would like to change the default in this layout.
1616
default region = content
1717

18-
; Added by Backdrop CMS packaging script on 2024-09-15
18+
; Added by Backdrop CMS packaging script on 2024-11-20
1919
project = backdrop
20-
version = 1.29.0
21-
timestamp = 1726467067
20+
version = 1.29.2
21+
timestamp = 1732142640

docroot/core/layouts/legacy/two_column_flipped/two_column_flipped.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ regions[footer] = Footer
1515
; Modify this line if you would like to change the default in this layout.
1616
default region = content
1717

18-
; Added by Backdrop CMS packaging script on 2024-09-15
18+
; Added by Backdrop CMS packaging script on 2024-11-20
1919
project = backdrop
20-
version = 1.29.0
21-
timestamp = 1726467067
20+
version = 1.29.2
21+
timestamp = 1732142640

docroot/core/layouts/moscone/moscone.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ preview = moscone.png
2626
; Include the Bootstrap4 Grid System
2727
libraries[] = bootstrap4-gs
2828

29-
; Added by Backdrop CMS packaging script on 2024-09-15
29+
; Added by Backdrop CMS packaging script on 2024-11-20
3030
project = backdrop
31-
version = 1.29.0
32-
timestamp = 1726467067
31+
version = 1.29.2
32+
timestamp = 1732142640

docroot/core/layouts/moscone_flipped/moscone_flipped.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ preview = moscone-flipped.png
2626
; Include the Bootstrap4 Grid System
2727
libraries[] = bootstrap4-gs
2828

29-
; Added by Backdrop CMS packaging script on 2024-09-15
29+
; Added by Backdrop CMS packaging script on 2024-11-20
3030
project = backdrop
31-
version = 1.29.0
32-
timestamp = 1726467067
31+
version = 1.29.2
32+
timestamp = 1732142640

docroot/core/layouts/rolph/rolph.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ preview = rolph.png
2828
; Include the Bootstrap4 Grid System
2929
libraries[] = bootstrap4-gs
3030

31-
; Added by Backdrop CMS packaging script on 2024-09-15
31+
; Added by Backdrop CMS packaging script on 2024-11-20
3232
project = backdrop
33-
version = 1.29.0
34-
timestamp = 1726467067
33+
version = 1.29.2
34+
timestamp = 1732142640

docroot/core/layouts/simmons/simmons.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ file = simmons.php
3434
; Default stylesheets for this layout
3535
; stylesheets[all][] = simmons.css
3636

37-
; Added by Backdrop CMS packaging script on 2024-09-15
37+
; Added by Backdrop CMS packaging script on 2024-11-20
3838
project = backdrop
39-
version = 1.29.0
40-
timestamp = 1726467067
39+
version = 1.29.2
40+
timestamp = 1732142640

docroot/core/layouts/sutro/sutro.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ preview = sutro.png
2727
; Include the Bootstrap4 Grid System
2828
libraries[] = bootstrap4-gs
2929

30-
; Added by Backdrop CMS packaging script on 2024-09-15
30+
; Added by Backdrop CMS packaging script on 2024-11-20
3131
project = backdrop
32-
version = 1.29.0
33-
timestamp = 1726467067
32+
version = 1.29.2
33+
timestamp = 1732142640

docroot/core/layouts/taylor/taylor.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ preview = taylor.png
2727
; Include the Bootstrap4 Grid System
2828
libraries[] = bootstrap4-gs
2929

30-
; Added by Backdrop CMS packaging script on 2024-09-15
30+
; Added by Backdrop CMS packaging script on 2024-11-20
3131
project = backdrop
32-
version = 1.29.0
33-
timestamp = 1726467067
32+
version = 1.29.2
33+
timestamp = 1732142640

docroot/core/layouts/taylor_flipped/taylor_flipped.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ preview = taylor-flipped.png
2727
; Include the Bootstrap4 Grid System
2828
libraries[] = bootstrap4-gs
2929

30-
; Added by Backdrop CMS packaging script on 2024-09-15
30+
; Added by Backdrop CMS packaging script on 2024-11-20
3131
project = backdrop
32-
version = 1.29.0
33-
timestamp = 1726467067
32+
version = 1.29.2
33+
timestamp = 1732142640

docroot/core/modules/admin_bar/admin_bar.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ backdrop = 1.x
1111
configure = admin/config/administration/admin-bar
1212

1313

14-
; Added by Backdrop CMS packaging script on 2024-09-15
14+
; Added by Backdrop CMS packaging script on 2024-11-20
1515
project = backdrop
16-
version = 1.29.0
17-
timestamp = 1726467067
16+
version = 1.29.2
17+
timestamp = 1732142640

docroot/core/modules/admin_bar/js/admin_bar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Backdrop.adminBar.behaviors.resizeCollapse = function (context, settings, $admin
201201
extraWidth = $extra.width() || 0;
202202

203203
// Available width is anything except the menus that may be collapsed.
204-
availableWidth = $adminBar.width();
204+
availableWidth = $(window).width();
205205
$adminBar.children().children().not($menu).not($extra).each(function() {
206206
availableWidth -= $(this).width();
207207
});

0 commit comments

Comments
 (0)