Skip to content

Commit

Permalink
Merge branch 'release/4.3.11' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Mar 7, 2023
2 parents af40a2d + bd93e5f commit d619527
Show file tree
Hide file tree
Showing 91 changed files with 320 additions and 243 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Release Notes for Craft CMS 4

## 4.3.11 - 2023-03-07

- Fixed a bug where `craft\events\RegisterElementSourcesEvent::$context` wasn’t always set to `modal` when defining the available element sources for an element selection modal.
- Fixed a styling bug where multi-line checkbox labels within the Customize Sources modal and View menu weren’t wrapping properly. ([#12717](https://github.com/craftcms/cms/issues/12717))
- Fixed a bug where asset thumbnails within collapsed Matrix blocks weren’t loading when the block was expanded. ([#12720](https://github.com/craftcms/cms/issues/12720))
- Fixed a bug where user activation/verification/reset-password URLs could be root-relative, if the `@web` alias was explicitly set to a root-relative URL.
- Fixed a PHP error that could occur if an options field’s condition rule wasn’t configured with any values. ([#12713](https://github.com/craftcms/cms/pull/12713))
- Fixed a bug where control panel notifications weren’t being announced to screen readers. ([#12714](https://github.com/craftcms/cms/pull/12714))
- Fixed a bug where localized relations could be moved to a newly-added site rather than copied, when applying project config changes. ([#12702](https://github.com/craftcms/cms/issues/12702))
- Fixed a bug where element indexes’ “View” buttons could be inconsistently positioned in the toolbar.
- Fixed a bug where element selector modal footers could hide the modal contents. ([#12708](https://github.com/craftcms/cms/issues/12708))
- Fixed a bug where asset thumbnails weren’t respecting the `generateTransformsBeforePageLoad` config setting. ([#12750](https://github.com/craftcms/cms/issues/12750))
- Fixed a bug where soft hyphens, non-breaking spaces, zero-width characters, invisible times characters, and invisible separators weren’t getting stripped from sanitized asset filenames. ([#12741](https://github.com/craftcms/cms/issues/12741), [#12759](https://github.com/craftcms/cms/pull/12759))
- Fixed a bug where custom fields’ database columns would get deleted when applying project config changes, if the field type wasn’t present. ([#12760](https://github.com/craftcms/cms/issues/12760))
- Fixed an error that could occur if a non-numeric value was entered into an image transform’s Width or Height settings. ([#12776](https://github.com/craftcms/cms/pull/12776))
- Fixed a bug where Assets, Categories, and Tags fields weren’t respecting their “Allow self relations” settings. ([#12769](https://github.com/craftcms/cms/issues/12769))
- Fixed a bug where dynamically-generated entry titles weren’t always generated with the site’s formatting locale in place. ([12780](https://github.com/craftcms/cms/issues/12780))
- Fixed a bug where element titles weren’t getting a pointer cursor or underlines on hover, when selected on an element index page.
- Fixed a bug where it wasn’t possible to close modals that were opened by a custom select menu via the `<kbd>Esc</kbd>` key. ([#12814](https://github.com/craftcms/cms/pull/12814))
- Fixed an error that could occur when saving an element with an eager-loaded Matrix field. ([#12815](https://github.com/craftcms/cms/issues/12815))
- Fixed a bug where the “send to Developer Support” links within the Craft Support widget weren’t working. ([#12822](https://github.com/craftcms/cms/issues/12822))

## 4.3.10 - 2023-02-17

- Fixed a bug where clicking on the scrollbar of a disclosure menu would close it. ([#12681](https://github.com/craftcms/cms/issues/12681))
Expand Down
62 changes: 31 additions & 31 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/Craft.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ public static function cookieConfig(array $config = [], ?Request $request = null
$generalConfig = static::$app->getConfig()->getGeneral();

if ($generalConfig->useSecureCookies === 'auto') {
if ($request === null) {
$request = static::$app->getRequest();
}
$request = $request ?? static::$app->getRequest();

$generalConfig->useSecureCookies = $request->getIsSecureConnection();
if (!$request->getIsConsoleRequest()) {
$generalConfig->useSecureCookies = $request->getIsSecureConnection();
}
}

self::$_baseCookieConfig = [
Expand Down
2 changes: 1 addition & 1 deletion src/base/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -3164,7 +3164,7 @@ public function getEnabledForSite(?int $siteId = null): ?bool
return $this->_enabledForSite[$siteId] ?? ($siteId == $this->siteId ? true : null);
}
if ($siteId == $this->siteId) {
return is_bool($this->_enabledForSite) ? $this->_enabledForSite : true;
return $this->_enabledForSite;
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return [
'id' => 'CraftCMS',
'name' => 'Craft CMS',
'version' => '4.3.10',
'version' => '4.3.11',
'schemaVersion' => '4.0.0.9',
'minVersionRequired' => '3.7.11',
'basePath' => dirname(__DIR__), // Defines the @app alias
Expand Down
36 changes: 0 additions & 36 deletions src/controllers/CategoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,42 +480,6 @@ private function _populateCategoryModel(Category $category): void
}
}

/**
* Displays a category.
*
* @param Category $category
* @return Response
* @throws ServerErrorHttpException if the category doesn't have a URL for the site it's configured with, or if the category's site ID is invalid
*/
private function _showCategory(Category $category): Response
{
$categoryGroupSiteSettings = $category->getGroup()->getSiteSettings();

if (!isset($categoryGroupSiteSettings[$category->siteId]) || !$categoryGroupSiteSettings[$category->siteId]->hasUrls) {
throw new ServerErrorHttpException('The category ' . $category->id . ' doesn’t have a URL for the site ' . $category->siteId . '.');
}

$site = Craft::$app->getSites()->getSiteById($category->siteId, true);

if (!$site) {
throw new ServerErrorHttpException('Invalid site ID: ' . $category->siteId);
}

Craft::$app->language = $site->language;
Craft::$app->set('locale', Craft::$app->getI18n()->getLocaleById($site->language));

// Have this category override any freshly queried categories with the same ID/site
if ($category->id) {
Craft::$app->getElements()->setPlaceholderElement($category);
}

$this->getView()->getTwig()->disableStrictVariables();

return $this->renderTemplate($categoryGroupSiteSettings[$category->siteId]->template, [
'category' => $category,
]);
}

/**
* Returns the HTML for a Categories field input, based on a given list of selected category IDs.
*
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/ElementSelectorModalsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function actionBody(): Response

if (is_array($sourceKeys)) {
$indexedSourceKeys = array_flip($sourceKeys);
$allSources = Craft::$app->getElementSources()->getSources($elementType);
$allSources = Craft::$app->getElementSources()->getSources($elementType, $context);
$sources = [];

foreach ($allSources as $source) {
Expand Down Expand Up @@ -81,7 +81,7 @@ public function actionBody(): Response
}
}
} else {
$sources = Craft::$app->getElementSources()->getSources($elementType);
$sources = Craft::$app->getElementSources()->getSources($elementType, $context);
}

// Show the sidebar if there are at least two (non-heading) sources
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/ImageTransformsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ public function actionSave(): ?Response
$transform->id = $this->request->getBodyParam('transformId');
$transform->name = $this->request->getBodyParam('name');
$transform->handle = $this->request->getBodyParam('handle');
$transform->width = $this->request->getBodyParam('width') ?: null;
$transform->height = $this->request->getBodyParam('height') ?: null;
$transform->width = (int)$this->request->getBodyParam('width') ?: null;
$transform->height = (int)$this->request->getBodyParam('height') ?: null;
$transform->mode = $this->request->getBodyParam('mode');
$transform->position = $this->request->getBodyParam('position');
$transform->quality = $this->request->getBodyParam('quality') ?: null;
Expand Down
10 changes: 9 additions & 1 deletion src/elements/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -1780,12 +1780,20 @@ public function updateTitle(): void
Craft::$app->getLocale();
// Set Craft to the entry’s site’s language, in case the title format has any static translations
$language = Craft::$app->language;
Craft::$app->language = $this->getSite()->language;
$locale = Craft::$app->getLocale();
$formattingLocale = Craft::$app->getFormattingLocale();
$site = $this->getSite();
$tempLocale = Craft::$app->getI18n()->getLocaleById($site->language);
Craft::$app->language = $site->language;
Craft::$app->set('locale', $tempLocale);
Craft::$app->set('formattingLocale', $tempLocale);
$title = Craft::$app->getView()->renderObjectTemplate($entryType->titleFormat, $this);
if ($title !== '') {
$this->title = $title;
}
Craft::$app->language = $language;
Craft::$app->set('locale', $locale);
Craft::$app->set('formattingLocale', $formattingLocale);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fields/Matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,8 @@ public function afterElementPropagate(ElementInterface $element, bool $isNew): v
$value = $element->getFieldValue($this->handle);
if ($value instanceof MatrixBlockQuery) {
$this->_populateQuery($value, $element);
$value->clearCachedResult();
}
$value->clearCachedResult();
}

parent::afterElementPropagate($element, $isNew);
Expand Down
1 change: 1 addition & 0 deletions src/fields/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s
'targetSiteId' => $this->targetSiteId($element),
'sourceElementId' => $element?->id,
'selectionLabel' => $this->selectionLabel ? Craft::t('site', $this->selectionLabel) : static::defaultSelectionLabel(),
'allowSelfRelations' => (bool)$this->allowSelfRelations,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/fields/conditions/OptionsFieldConditionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function options(): array
/**
* @inheritdoc
*/
protected function elementQueryParam(): array
protected function elementQueryParam(): ?array
{
return $this->paramValue();
}
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/FileHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ public static function sanitizeFilename(string $filename, array $options = []):
// Replace any control characters in the name with a space.
$filename = preg_replace("/\\x{00a0}/iu", ' ', $filename);

// https://github.com/craftcms/cms/issues/12741
// Remove soft hyphens (00ad), no break (0083), zero width non-joiner (200c),
// zero width joiner (200d), invisible times (2062), invisible comma (2063) in the name
$filename = preg_replace('/\\x{00ad}|\\x{0083}|\\x{200c}|\\x{200d}|\\x{2062}|\\x{2063}/iu', '', $filename);

// Strip any characters not allowed.
$filename = str_replace($disallowedChars, '', strip_tags($filename));

Expand Down
5 changes: 3 additions & 2 deletions src/helpers/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -1007,12 +1007,13 @@ public static function encodeInvalidTags(string $html): string
*
* @param string|Asset $svg An SVG asset, a file path, or raw SVG markup
* @param bool|null $sanitize Whether the SVG should be sanitized of potentially
* malicious scripts. By default the SVG will only be sanitized if an asset
* malicious scripts. By default, the SVG will only be sanitized if an asset
* or markup is passed in. (File paths are assumed to be safe.)
* @param bool|null $namespace Whether class names and IDs within the SVG
* should be namespaced to avoid conflicts with other elements in the DOM.
* By default the SVG will only be namespaced if an asset or markup is passed in.
* By default, the SVG will only be namespaced if an asset or markup is passed in.
* @return string
* @since 4.3.0
*/
public static function svg(Asset|string $svg, ?bool $sanitize = null, ?bool $namespace = null): string
{
Expand Down
Loading

0 comments on commit d619527

Please sign in to comment.