Skip to content

Commit de2e5ea

Browse files
authored
Fix #20230: Fix getting ID in \yii\filters\Cors::actions() when attached to a module
1 parent 4b0a02e commit de2e5ea

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

framework/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Yii Framework 2 Change Log
1010
- Bug #20211: Add acceptable parameters to `MaskedInput::init()` method (alxlnk)
1111
- Bug #20226: Revert all PR for "Data providers perform unnecessary COUNT queries that negatively affect performance" (@terabytesoftw)
1212
- Bug #20147: Fix error handler compatibility with PHP 8.3 (samdark)
13+
- Bug #20230: Fix getting ID in `\yii\filters\Cors::actions()` when attached to a module (timkelty)
1314

1415

1516
2.0.50 May 30, 2024

framework/filters/Cors.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ public function beforeAction($action)
123123
*/
124124
public function overrideDefaultSettings($action)
125125
{
126-
if (isset($this->actions[$action->id])) {
127-
$actionParams = $this->actions[$action->id];
126+
$actionId = $this->getActionId($action);
127+
128+
if (isset($this->actions[$actionId])) {
129+
$actionParams = $this->actions[$actionId];
128130
$actionParamsKeys = array_keys($actionParams);
129131
foreach ($this->cors as $headerField => $headerValue) {
130132
if (in_array($headerField, $actionParamsKeys)) {

0 commit comments

Comments
 (0)