Skip to content

Commit

Permalink
4.11.0.2 - getQueryParam() only exists for web requests
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Aug 6, 2024
1 parent 53d5796 commit e3137a3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Craft CMS 4

## 4.11.0.2 - 2024-08-06

- Fixed an error that could occur on console requests.

## 4.11.0.1 - 2024-08-06

- Fixed an error that occurred when accessing custom config settings defined in `config/custom.php`. ([#15481](https://github.com/craftcms/cms/issues/15481))
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.11.0.1',
'version' => '4.11.0.2',
'schemaVersion' => '4.5.3.0',
'minVersionRequired' => '3.7.11',
'basePath' => dirname(__DIR__), // Defines the @app alias
Expand Down
18 changes: 10 additions & 8 deletions src/helpers/UrlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,17 +630,19 @@ private static function _createUrl(
}
} else {
// token/siteToken/preview params
if ($addToken && !isset($params[$generalConfig->tokenParam]) && ($token = $request->getToken()) !== null) {
$params[$generalConfig->tokenParam] = $token;
}
if (!isset($params[$generalConfig->siteToken]) && ($siteToken = $request->getSiteToken()) !== null) {
$params[$generalConfig->siteToken] = $siteToken;
}
if (!isset($params['x-craft-preview']) && !isset($params['x-craft-live-preview'])) {
if (($previewToken = $request->getQueryParam('x-craft-preview')) !== null) {
$params['x-craft-preview'] = $previewToken;
} elseif (($previewToken = $request->getQueryParam('x-craft-live-preview')) !== null) {
$params['x-craft-live-preview'] = $previewToken;
if ($request->getIsSiteRequest()) {
if ($addToken && !isset($params[$generalConfig->tokenParam]) && ($token = $request->getToken()) !== null) {
$params[$generalConfig->tokenParam] = $token;
}
if (!isset($params['x-craft-preview']) && !isset($params['x-craft-live-preview'])) {
if (($previewToken = $request->getQueryParam('x-craft-preview')) !== null) {
$params['x-craft-preview'] = $previewToken;
} elseif (($previewToken = $request->getQueryParam('x-craft-live-preview')) !== null) {
$params['x-craft-live-preview'] = $previewToken;
}
}
}
}
Expand Down

0 comments on commit e3137a3

Please sign in to comment.