diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index fda96ccd2cd..7dca0fb1296 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -10,6 +10,7 @@ Yii Framework 2 Change Log - Bug #20211: Add acceptable parameters to `MaskedInput::init()` method (alxlnk) - Bug #20226: Revert all PR for "Data providers perform unnecessary COUNT queries that negatively affect performance" (@terabytesoftw) - Bug #20147: Fix error handler compatibility with PHP 8.3 (samdark) +- Bug #20230: Fix getting ID in `\yii\filters\Cors::actions()` when attached to a module (timkelty) 2.0.50 May 30, 2024 diff --git a/framework/filters/Cors.php b/framework/filters/Cors.php index b6b99a79bfc..c377dcb0994 100644 --- a/framework/filters/Cors.php +++ b/framework/filters/Cors.php @@ -123,8 +123,10 @@ public function beforeAction($action) */ public function overrideDefaultSettings($action) { - if (isset($this->actions[$action->id])) { - $actionParams = $this->actions[$action->id]; + $actionId = $this->getActionId($action); + + if (isset($this->actions[$actionId])) { + $actionParams = $this->actions[$actionId]; $actionParamsKeys = array_keys($actionParams); foreach ($this->cors as $headerField => $headerValue) { if (in_array($headerField, $actionParamsKeys)) {