Skip to content

Commit de7ad3e

Browse files
committed
Merge branch '5.9' into lupe/pt-2223-the-orientation-fieldset-doesnt-have-a-visual-group-label
# Conflicts: # src/web/assets/cp/dist/css/cp.css # src/web/assets/cp/dist/css/cp.css.map
2 parents 911c065 + dd119f2 commit de7ad3e

Some content is hidden

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

71 files changed

+484
-167
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,44 @@
22

33
## Unreleased
44

5+
- Fixed a bug where reference tags that only referenced an entry’s slug weren’t resolving.
6+
- Fixed an error that could occur when installing Craft with existing project config data. ([#17587](https://github.com/craftcms/cms/issues/17587))
7+
8+
## 5.8.12 - 2025-07-29
9+
10+
- Added support for passing a hashed `returnUrl` param to standalone Live Preview URLs. ([#17684](https://github.com/craftcms/cms/discussions/17684))
11+
- Improved the performance of fetching nested values within content block fields. ([#17677](https://github.com/craftcms/cms/issues/17677))
12+
- Fixed a bug where embedded element indexes were manipulating the window title. ([#17679](https://github.com/craftcms/cms/issues/17679))
13+
- Fixed an error that could occur when rendering an Entries field. ([#17686](https://github.com/craftcms/cms/issues/17686))
14+
- Fixed a bug where element selection modals weren’t rendering elements in a structure view when they should have. ([#17678](https://github.com/craftcms/cms/issues/17678))
15+
16+
## 5.8.11 - 2025-07-25
17+
18+
- Fixed a JavaScript error that occurred when applying a draft that had a percent sign in its name. ([#17674](https://github.com/craftcms/cms/issues/17674))
19+
- Fixed a bug where custom source headings could have IDs that conflicted with other control panel components. ([#17632](https://github.com/craftcms/cms/issues/17632))
20+
- Fixed a potential session leakage vulnerability.
21+
22+
## 5.8.10 - 2025-07-24
23+
24+
- Added `craft\helpers\User::getLoginFailureInfo()`.
25+
- Deprecated `craft\helpers\User::getLoginFailureMessage()`.
26+
- Fixed a potential user account enumeration bug when `preventUserEnumeration` was enabled.
27+
28+
## 5.8.9 - 2025-07-24
29+
530
- Element index and edit pages now include the selected site’s name in the window title, on multi-site installs. ([#17626](https://github.com/craftcms/cms/pull/17626))
631
- Entry type handles are now automatically incremented when duplicating an entry type, if the handle wasn’t edited. ([#17641](https://github.com/craftcms/cms/issues/17641))
32+
- JSON fields now have a max height of 550px. ([#17667](https://github.com/craftcms/cms/issues/17667))
33+
- Fixed a SQL error that could occur when applying a draft that belonged to fewer sites than the canonical element. ([#17644](https://github.com/craftcms/cms/issues/17644))
34+
- Fixed an error that could occur when applying project config changes. ([#17625](https://github.com/craftcms/cms/issues/17625))
35+
- Fixed a bug where the password reset form could incorrectly have `newUser` set to `true`. ([#17659](https://github.com/craftcms/cms/issues/17659))
36+
- Fixed an error that could occur when exporting elements as XML. ([#17668](https://github.com/craftcms/cms/issues/17668))
737
- Fixed a bug where element indexes in structure view weren’t switching to table/card view when searching.
838
- Fixed a bug where Assets fields’ “Show the search input” setting wasn’t always visible when “Restrict assets to a single location” was enabled. ([#17628](https://github.com/craftcms/cms/issues/17628))
939
- Fixed a bug where relational fields were showing the search input if “All” sources were selected, but there was only one available source. ([#17628](https://github.com/craftcms/cms/issues/17628))
40+
- Fixed a bug where top-level element sources’ expanded/collapsed states were stored as cookies rather than in local storage. ([#17649](https://github.com/craftcms/cms/issues/17649))
41+
- Fixed a bug where entry authors could be set to the current user when resaved in bulk. ([#17654](https://github.com/craftcms/cms/pull/17654))
42+
- Fixed a bug where generated fields were showing up within card views even if they weren’t selected. ([#17662](https://github.com/craftcms/cms/issues/17662))
1043

1144
## 5.8.8 - 2025-07-18
1245

src/base/Element.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use craft\elements\actions\View as ViewAction;
2929
use craft\elements\conditions\ElementCondition;
3030
use craft\elements\conditions\ElementConditionInterface;
31+
use craft\elements\ContentBlock;
3132
use craft\elements\db\EagerLoadPlan;
3233
use craft\elements\db\ElementQuery;
3334
use craft\elements\db\ElementQueryInterface;
@@ -5237,7 +5238,7 @@ public function setFieldValues(array $values): void
52375238
private function clonedFieldValue(string $fieldHandle): mixed
52385239
{
52395240
$value = $this->getFieldValue($fieldHandle);
5240-
if (is_object($value) && !$value instanceof UnitEnum) {
5241+
if (is_object($value) && !$value instanceof UnitEnum && !$value instanceof ContentBlock) {
52415242
return clone $value;
52425243
}
52435244
return $value;

src/config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return [
44
'id' => 'CraftCMS',
55
'name' => 'Craft CMS',
6-
'version' => '5.8.8',
6+
'version' => '5.8.12',
77
'schemaVersion' => '5.8.0.3',
88
'minVersionRequired' => '4.5.0',
99
'basePath' => dirname(__DIR__), // Defines the @app alias

src/controllers/ElementIndexesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ public function actionExport(): Response
412412
break;
413413
case Response::FORMAT_XML:
414414
Craft::$app->language = 'en-US';
415-
$this->response->formatters[Response::FORMAT_XML]['rootTag'] = $this->elementType::pluralLowerDisplayName();
415+
$this->response->formatters[Response::FORMAT_XML]['rootTag'] = StringHelper::toCamelCase($this->elementType::pluralLowerDisplayName());
416416
break;
417417
}
418418
} elseif (

src/controllers/ElementsController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,16 @@ public function actionPreview(int $elementId): Response
534534

535535
$this->element = $element;
536536

537+
// Screen prep
538+
$redirectUrl = $this->request->getValidatedQueryParam('returnUrl') ?? ElementHelper::postEditUrl($element);
539+
537540
$this->getView()->registerJsWithVars(fn(
538541
$elementType,
539542
$elementId,
540543
$draftId,
541544
$revisionId,
542545
$siteId,
546+
$redirectUrl,
543547
) => <<<JS
544548
(() => {
545549
const preview = new Craft.Preview({
@@ -549,6 +553,7 @@ public function actionPreview(int $elementId): Response
549553
revisionId: $revisionId,
550554
siteId: $siteId,
551555
standaloneMode: true,
556+
redirectUrl: $redirectUrl,
552557
});
553558
preview.open();
554559
})();
@@ -558,6 +563,7 @@ public function actionPreview(int $elementId): Response
558563
!$element->isProvisionalDraft ? $element->draftId : null,
559564
$element->revisionId,
560565
$element->siteId,
566+
$redirectUrl,
561567
], View::POS_END);
562568

563569
[$docTitle, $title] = $this->_editElementTitles($element);

src/controllers/UpgradeController.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* @link https://craftcms.com/
4+
* @copyright Copyright (c) Pixel & Tonic, Inc.
5+
* @license https://craftcms.github.io/license/
6+
*/
7+
8+
namespace craft\controllers;
9+
10+
use Craft;
11+
use craft\helpers\Json;
12+
use craft\utilities\Upgrade;
13+
use craft\web\Controller;
14+
use yii\web\ForbiddenHttpException;
15+
use yii\web\Response;
16+
17+
/**
18+
* @author Pixel & Tonic, Inc. <[email protected]>
19+
* @internal
20+
*/
21+
class UpgradeController extends Controller
22+
{
23+
public function beforeAction($action): bool
24+
{
25+
if (!parent::beforeAction($action)) {
26+
return false;
27+
}
28+
29+
if (Craft::$app->getUtilities()->checkAuthorization(Upgrade::class) === false) {
30+
throw new ForbiddenHttpException(sprintf('User not permitted to access the “%s” utility.', Upgrade::displayName()));
31+
}
32+
33+
return true;
34+
}
35+
36+
public function actionPrepComposerJson(): Response
37+
{
38+
$versions = $this->request->getBodyParam('versions');
39+
$composerService = Craft::$app->getComposer();
40+
$jsonPath = $composerService->getJsonPath();
41+
$json = file_get_contents($jsonPath);
42+
$config = Json::decode($json);
43+
44+
$config['require']['craftcms/cms'] = $versions['craft'];
45+
46+
if (isset($versions['php'], $config['config']['platform']['php'])) {
47+
$config['config']['platform']['php'] = $versions['php'];
48+
}
49+
50+
if (!empty($versions['plugins'])) {
51+
$pluginsService = Craft::$app->getPlugins();
52+
foreach ($versions['plugins'] as $handle => $version) {
53+
$info = $pluginsService->getPluginInfo($handle);
54+
$config['require'][$info['packageName']] = $version;
55+
unset($config['require-dev'][$info['packageName']]);
56+
}
57+
}
58+
59+
if ($config['config']['sort-packages'] ?? false) {
60+
$composerService->sortPackages($config['require']);
61+
}
62+
63+
$json = Json::encode($config, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
64+
$indent = Json::detectIndent(file_get_contents($jsonPath));
65+
$json = Json::reindent($json, $indent);
66+
67+
return $this->asJson([
68+
'json' => $json,
69+
]);
70+
}
71+
}

src/controllers/UsersController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,11 @@ public function actionSetPassword(): Response
846846
// POST request. They've just set the password.
847847
$code = $this->request->getRequiredBodyParam('code');
848848
$uid = $this->request->getRequiredParam('id');
849-
$user = Craft::$app->getUsers()->getUserByUid($uid);
849+
$user = User::find()
850+
->uid($uid)
851+
->status(null)
852+
->addSelect(['users.password'])
853+
->one();
850854

851855
if (!$user) {
852856
throw new BadRequestHttpException("Invalid user UUID: $uid");
@@ -2418,7 +2422,7 @@ public function actionVerifyPassword(): ?Response
24182422
*/
24192423
private function _handleLoginFailure(?string $authError = null, ?User $user = null): ?Response
24202424
{
2421-
$message = UserHelper::getLoginFailureMessage($authError, $user);
2425+
[$authError, $message] = UserHelper::getLoginFailureInfo($authError, $user);
24222426

24232427
// Fire a 'loginFailure' event
24242428
if ($this->hasEventHandlers(self::EVENT_LOGIN_FAILURE)) {
@@ -2431,7 +2435,6 @@ private function _handleLoginFailure(?string $authError = null, ?User $user = nu
24312435
$message = $event->message;
24322436
}
24332437

2434-
24352438
return $this->asFailure(
24362439
$message,
24372440
data: [

src/controllers/UtilitiesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function actionShowUtility(string $id): Response
116116
}
117117

118118
if ($utilitiesService->checkAuthorization($class) === false) {
119-
throw new ForbiddenHttpException('User not permitted to access the "' . $class::displayName() . '".');
119+
throw new ForbiddenHttpException(sprintf('User not permitted to access the “%s” utility.', $class::displayName()));
120120
}
121121

122122
$this->getView()->registerAssetBundle(UtilitiesAsset::class);

src/elements/Entry.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2809,6 +2809,11 @@ public function beforeSave(bool $isNew): bool
28092809
*/
28102810
private function maybeSetDefaultAttributes(): void
28112811
{
2812+
// if we're resaving, we shouldn't be setting the defaults
2813+
if ($this->resaving) {
2814+
return;
2815+
}
2816+
28122817
if (
28132818
(!isset($this->_authorIds) || empty($this->_authorIds)) &&
28142819
!isset($this->fieldId) &&

src/elements/NestedElementManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private function setOwnerOnNestedElements(ElementInterface $owner, array $elemen
231231
{
232232
foreach ($elements as $element) {
233233
$element->setOwner($owner);
234-
if ($element->id === $element->getPrimaryOwnerId()) {
234+
if ($owner->id === $element->getPrimaryOwnerId()) {
235235
$element->setPrimaryOwner($owner);
236236
}
237237
}

0 commit comments

Comments
 (0)