Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix namespace issue #16602

Merged
merged 1 commit into from Aug 3, 2018
Merged

Fix namespace issue #16602

merged 1 commit into from Aug 3, 2018

Conversation

SergeAx
Copy link

@SergeAx SergeAx commented Aug 3, 2018

Causes an error when YII_DEBUG is true, $cors['Origin'] contains '*' and $cors['Access-Control-Allow-Credentials'] is true

Q A
Is bugfix? yes
New feature? no
Breaks BC? no
Tests pass? --
Fixed issues --

Causes an error when `YII_DEBUG` is `true`, `$cors['Origin']` contains `'*'` and `$cors['Access-Control-Allow-Credentials']` is `true`
@samdark samdark added the type:bug Bug label Aug 3, 2018
@samdark samdark merged commit 7f36d26 into yiisoft:3.0 Aug 3, 2018
@samdark
Copy link
Member

samdark commented Aug 3, 2018

Merged. Thanks!

@samdark samdark added this to the 2.0.16 milestone Aug 3, 2018
@SergeAx SergeAx deleted the patch-1 branch August 4, 2018 07:45
@@ -167,7 +167,7 @@ public function prepareHeaders($requestHeaders)
// Per CORS standard (https://fetch.spec.whatwg.org), wildcard origins shouldn't be used together with credentials
if (isset($this->cors['Access-Control-Allow-Credentials']) && $this->cors['Access-Control-Allow-Credentials']) {
if (YII_DEBUG) {
throw new Exception("Allowing credentials for wildcard origins is insecure. Please specify more restrictive origins or set 'credentials' to false in your CORS configuration.");
throw new \Exception("Allowing credentials for wildcard origins is insecure. Please specify more restrictive origins or set 'credentials' to false in your CORS configuration.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not look right - \Exception is too generic. It should be InvalidConfigException or at least yii\base\Exception.

@rob006
Copy link
Contributor

rob006 commented Aug 4, 2018

This was already fixed in master: #16292

Why this change is target to 2.0.16 but merged to 3.0? Both versions should use the same fix with InvalidConfigException instead \Exception.

@samdark
Copy link
Member

samdark commented Aug 4, 2018

Oh, thought it's against master... 3.0 branch doesn't make much sense now as we're doing it other way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants