豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit f04db79

Browse files
committed
Merge branch '4.x' into advisories
# Conflicts: # CHANGELOG.md
2 parents d20aecf + b050c20 commit f04db79

File tree

8 files changed

+26
-21
lines changed

8 files changed

+26
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- Fixed a bug where `users/suspend-user` and `users/unsuspend-user` actions required that the logged-in user have control panel access. ([#18485](https://github.com/craftcms/cms/issues/18485))
77
- Fixed a bug where flipping an image within the Image Editor didn’t always work. ([#18486](https://github.com/craftcms/cms/issues/18486))
88
- Fixed a bug where SVG files missing their `width` and `height` attributes weren’t getting them set as expected.
9+
- Fixed an error that occurred if a template referenced a preloaded Single entry followed by a null coalescing operator. ([#18503](https://github.com/craftcms/cms/issues/18503))
10+
- Fixed a bug where links within Redactor fields were getting `target="_blank"` added to them. ([#18500](https://github.com/craftcms/cms/issues/18500))
911
- Fixed a [moderate-severity](https://github.com/craftcms/cms/security/policy#severity--remediation) SSRF vulnerability. (GHSA-3m9m-24vh-39wx)
1012

1113
## 4.17.8 - 2026-02-25

src/helpers/Template.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class Template
6969
* @param string $name
7070
* @return bool
7171
* @since 4.4.0
72+
* @deprecated in 4.17.9
7273
*/
7374
public static function fallbackExists(string $name): bool
7475
{
@@ -81,6 +82,7 @@ public static function fallbackExists(string $name): bool
8182
* @param string $name
8283
* @throws UnknownPropertyException if `$name` isn’t defined as a fallback variable.
8384
* @since 4.4.0
85+
* @deprecated in 4.17.9
8486
*/
8587
public static function fallback(string $name): mixed
8688
{
@@ -400,14 +402,18 @@ public static function contextWithoutTemplate(array $context): array
400402
* @param string[] $handles
401403
* @since 4.4.0
402404
*/
403-
public static function preloadSingles(array $handles): void
405+
public static function preloadSingles(array $handles, ?array &$context = null): void
404406
{
405407
// Ignore handles that are defined Twig globals
406408
$globals = Craft::$app->view->getTwig()->getGlobals();
407409
$handles = array_diff($handles, array_keys($globals));
408410

409411
if (!empty($handles)) {
410-
self::$_fallbacks += Craft::$app->getEntries()->getSingleEntriesByHandle($handles);
412+
$singles = Craft::$app->getEntries()->getSingleEntriesByHandle($handles);
413+
self::$_fallbacks += $singles;
414+
if ($context !== null) {
415+
$context += $singles;
416+
}
411417
}
412418
}
413419
}

src/web/assets/cp/dist/cp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/dist/cp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/src/js/Craft.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,15 +1919,18 @@ $.extend(Craft, {
19191919

19201920
// Open outbound links in new windows
19211921
// hat tip: https://stackoverflow.com/a/2911045/1688568
1922-
$('a', $container).each(function () {
1923-
if (
1924-
this.hostname.length &&
1925-
this.hostname !== location.hostname &&
1926-
typeof $(this).attr('target') === 'undefined'
1927-
) {
1928-
$(this).attr('rel', 'noopener').attr('target', '_blank');
1929-
}
1930-
});
1922+
// ignore items in contenteditable divs (like redactor or ckeditor fields)
1923+
$('a', $container)
1924+
.not('[contenteditable="true"] a')
1925+
.each(function () {
1926+
if (
1927+
this.hostname.length &&
1928+
this.hostname !== location.hostname &&
1929+
typeof $(this).attr('target') === 'undefined'
1930+
) {
1931+
$(this).attr('rel', 'noopener').attr('target', '_blank');
1932+
}
1933+
});
19311934
},
19321935

19331936
_elementIndexClasses: {},

src/web/twig/nodes/FallbackNameExpression.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*
1818
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
1919
* @since 4.4.0
20+
* @deprecated in 4.17.9
2021
*/
2122
class FallbackNameExpression extends ContextVariable
2223
{

src/web/twig/nodes/PreloadSinglesNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function compile(Compiler $compiler): void
3030

3131
$compiler
3232
->write(sprintf(
33-
"%s::preloadSingles([%s]);\n",
33+
"%s::preloadSingles([%s], \$context);\n",
3434
Template::class,
3535
implode(', ', array_map(fn(string $handle) => "'$handle'", $this->getAttribute('handles'))),
3636
));

src/web/twig/nodevisitors/SinglePreloader.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace craft\web\twig\nodevisitors;
99

10-
use craft\web\twig\nodes\FallbackNameExpression;
1110
use craft\web\twig\nodes\PreloadSinglesNode;
1211
use Twig\Environment;
1312
use Twig\Node\BodyNode;
@@ -48,12 +47,6 @@ public function enterNode(Node $node, Environment $env): Node
4847
) {
4948
$variables = &$this->_foundVariables[0];
5049
$variables[$node->getAttribute('name')] = true;
51-
52-
// swap the node with a FallbackNameExpression
53-
$node = new FallbackNameExpression($node->getAttribute('name'), [
54-
'is_defined_test' => $node->getAttribute('is_defined_test'),
55-
'ignore_strict_check' => $node->getAttribute('ignore_strict_check'),
56-
], $node->getTemplateLine());
5750
}
5851

5952
return $node;

0 commit comments

Comments
 (0)