Skip to content

Commit d487e6b

Browse files
committed
Merge branch 'develop' into mmikkel-patch-5
2 parents b78ae00 + 74c7cd3 commit d487e6b

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
## Unreleased
44

5+
- Volumes no longer validate if their field layout contains a field called `extension`, `filename`, `height`, `kind`, `size`, or `width`.
56
- Stack traces returned by `craft\helpers\App::backtrace()` now more closely resemble exception stack traces.
67
- “Element query executed before Craft is fully initialized” warnings now include a stack trace.
8+
- Fixed a bug where queue-runner Ajax requests triggered on the front end weren’t getting closed before running the queue, potentially causing long front-end load delays.
79
- Fixed a user enumeration timing attack vulnerability.
810
- Fixed a SQL error that could occur when upgrading to Craft 4, if any `matrixblocks` table rows referenced nonexistent element IDs. ([#13121](https://github.com/craftcms/cms/issues/13121))
911
- Fixed a SQL error that could occur when upgrading to Craft 4, if anything triggered an asset or volume query. ([#13130](https://github.com/craftcms/cms/issues/13130))
1012
- Fixed a SQL error that occurred when deleting a category group on PostgreSQL, when configured with a table prefix. ([#13127](https://github.com/craftcms/cms/issues/13127))
13+
- Fixed a bug where it was possible to query for elements with soft-deleted site IDs.
1114
- Fixed a JavaScript error that could occur on the control panel login form.
1215

1316
## 4.4.8 - 2023-04-25

src/elements/db/ElementQuery.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use craft\helpers\ElementHelper;
3333
use craft\helpers\StringHelper;
3434
use craft\models\Site;
35+
use Illuminate\Support\Collection;
3536
use ReflectionClass;
3637
use ReflectionException;
3738
use ReflectionProperty;
@@ -2643,11 +2644,21 @@ private function _applyRevisionParams(): void
26432644
*/
26442645
private function _normalizeSiteId(): void
26452646
{
2647+
$sitesService = Craft::$app->getSites();
26462648
if (!$this->siteId) {
26472649
// Default to the current site
2648-
$this->siteId = Craft::$app->getSites()->getCurrentSite()->id;
2650+
$this->siteId = $sitesService->getCurrentSite()->id;
26492651
} elseif ($this->siteId === '*') {
2650-
$this->siteId = Craft::$app->getSites()->getAllSiteIds();
2652+
$this->siteId = $sitesService->getAllSiteIds();
2653+
} elseif (is_numeric($this->siteId) || ArrayHelper::isNumeric($this->siteId)) {
2654+
// Filter out any invalid site IDs
2655+
$siteIds = Collection::make((array)$this->siteId)
2656+
->filter(fn($siteId) => $sitesService->getSiteById($siteId, true) !== null)
2657+
->all();
2658+
if (empty($siteIds)) {
2659+
throw new QueryAbortedException();
2660+
}
2661+
$this->siteId = is_array($this->siteId) ? $siteIds : reset($siteIds);
26512662
}
26522663
}
26532664

src/models/Volume.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,14 @@ public function validateFieldLayout(): void
186186
$fieldLayout = $this->getFieldLayout();
187187
$fieldLayout->reservedFieldHandles = [
188188
'alt',
189+
'extension',
190+
'filename',
189191
'folder',
192+
'height',
193+
'kind',
194+
'size',
190195
'volume',
196+
'width',
191197
];
192198

193199
if (!$fieldLayout->validate()) {

src/queue/Queue.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -616,26 +616,13 @@ public function handleResponse(): void
616616
<script type="text/javascript">
617617
/*<![CDATA[*/
618618
(function(){
619-
var XMLHttpFactories = [
620-
function () {return new XMLHttpRequest()},
621-
function () {return new ActiveXObject("Msxml2.XMLHTTP")},
622-
function () {return new ActiveXObject("Msxml3.XMLHTTP")},
623-
function () {return new ActiveXObject("Microsoft.XMLHTTP")}
624-
];
625-
var req = false;
626-
for (var i = 0; i < XMLHttpFactories.length; i++) {
627-
try {
628-
req = XMLHttpFactories[i]();
629-
}
630-
catch (e) {
631-
continue;
632-
}
633-
break;
634-
}
635-
if (!req) return;
619+
try {
620+
var req = new XMLHttpRequest();
636621
req.open('GET', $url, true);
637-
if (req.readyState == 4) return;
622+
req.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
623+
if (req.readyState === 4) return;
638624
req.send();
625+
} catch (e) {}
639626
})();
640627
/*]]>*/
641628
</script>

0 commit comments

Comments
 (0)