Skip to content

Commit

Permalink
Merge branch '4.x' into 4.14
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Jan 15, 2025
2 parents 9cc052f + a93bea8 commit 01c2875
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## Unreleased

- Fixed a bug where the control panel could display a notice about the Craft CMS license belonging to a different domain, even when accessing the control panel from the correct domain. ([#16396](https://github.com/craftcms/cms/issues/16396))
- Fixed a bug where Unicode special characters weren’t getting stripped out of search keywords. ([#16430](https://github.com/craftcms/cms/issues/16430))
- Fixed an error that could occur when setting `relatedTo*` GraphQL arguments to `null`. ([#16431](https://github.com/craftcms/cms/issues/16431))

## 4.13.9 - 2025-01-06

Expand Down
26 changes: 24 additions & 2 deletions src/config/GeneralConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -2642,12 +2642,23 @@ class GeneralConfig extends BaseConfig
/**
* @var string A private, random, cryptographically-secure key that is used for hashing and encrypting data in [[\craft\services\Security]].
*
* This value should be the same across all environments. If this key ever changes, any data that was encrypted with it will be inaccessible.
* ::: warning
* **Do not** share this key publicly. If exposed, it could lead to a compromised system.
* :::
*
* In the event that the key is compromised, a new secure key can be generated with the command:
*
* ```sh
* php craft setup/security-key
* ```
*
* Note that if the key changes, any data that is encrypted with it (e.g. user session cookies) will be inaccessible.
*
* ```php Static Config
* ->securityKey('2cf24dba5...')
* ```
*
* @see https://craftcms.com/knowledge-base/securing-craft
* @group Security
*/
public string $securityKey = '';
Expand Down Expand Up @@ -6164,7 +6175,17 @@ public function sanitizeSvgUploads(bool $value = true): self
/**
* A private, random, cryptographically-secure key that is used for hashing and encrypting data in [[\craft\services\Security]].
*
* This value should be the same across all environments. If this key ever changes, any data that was encrypted with it will be inaccessible.
* ::: warning
* **Do not** share this key publicly. If exposed, it could lead to a compromised system.
* :::
*
* In the event that the key is compromised, a new secure key can be generated with the command:
*
* ```sh
* php craft setup/security-key
* ```
*
* Note that if the key changes, any data that is encrypted with it (e.g. user session cookies) will be inaccessible.
*
* ```php
* ->securityKey('2cf24dba5...')
Expand All @@ -6174,6 +6195,7 @@ public function sanitizeSvgUploads(bool $value = true): self
* @param string $value
* @return self
* @see $securityKey
* @see https://craftcms.com/knowledge-base/securing-craft
* @since 4.2.0
*/
public function securityKey(string $value): self
Expand Down
2 changes: 2 additions & 0 deletions src/gql/ElementQueryConditionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ private function _extractArgumentValue(Node $argumentNode): mixed
$extractedValue[$fieldNode->name->value] = $this->_extractArgumentValue($fieldNode);
}
return $extractedValue;
case 'NullValue':
return null;
default:
return $argumentNodeValue->value;
}
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public static function normalizeKeywords(array|string $str, array $ignore = [],
}
}

// Get rid of Unicode special characters
// (see https://github.com/craftcms/cms/issues/16430)
$str = preg_replace('/[\x{80}-\x{10FFFF}]/u', '', $str);

// Strip out new lines and superfluous spaces
return trim(preg_replace(['/[\n\r]+/u', '/\s{2,}/u'], ' ', $str));
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public function deleteFoldersByIds(int|array $folderIds, bool $deleteDir = true)
$assetQuery = Asset::find()->folderId($allFolderIds);
$elementService = Craft::$app->getElements();

foreach ($assetQuery->each() as $asset) {
foreach (Db::each($assetQuery) as $asset) {
/** @var Asset $asset */
$asset->keepFileOnDelete = !$deleteDir;
$elementService->deleteElement($asset, true);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/SearchHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function normalizeKeywordsDataProviders(): array
['', '&#11aa;'],
['test test', 'TEST TEST'],
['', ['', '', '', '']],
['♠ ♣ ♥ ♦', ['', '', '', ''], [], false],
['', ['', '', '', ''], [], false],
['test', 'test '],
['', 'test', ['test']],
['test', 'test👍'],
Expand Down

0 comments on commit 01c2875

Please sign in to comment.