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

Error displayed at production env, yii\web\DbSession, line 184 #11726

Closed
pastuhov opened this issue Jun 8, 2016 · 10 comments
Closed

Error displayed at production env, yii\web\DbSession, line 184 #11726

pastuhov opened this issue Jun 8, 2016 · 10 comments
Assignees
Labels
Milestone

Comments

@pastuhov
Copy link

pastuhov commented Jun 8, 2016

What steps will reproduce the problem?

  1. Production
  2. Using vendor/yiisoft/yii2/web/DbSession.php
  3. Problem with insert statment (Integrity constraint violation: SQLSTATE[23505]: Unique violation: 7 ERROR)

What is the expected result?

Error logged to error log (error_log()) and NO output to browser (no echo())

What do you get instead?

Error displayed

Additional info

Q A
Yii version 2.0.8
PHP version 7.0.7-1
Operating system Debian

Go deeper

  1. File vendor/yiisoft/yii2/web/DbSession.php
  2. Line 184 echo $exception;
  3. Why? 😃
@samdark
Copy link
Member

samdark commented Jun 8, 2016

It's not possible to move any further with the data provided. How to reproduce it?

@cebe
Copy link
Member

cebe commented Jun 8, 2016

please also provide the stack trace of the error

@cebe
Copy link
Member

cebe commented Jun 8, 2016

Is your application using on one server or are multiple servers using the same database?

@deadkrolik
Copy link

I have the same issue. I just want to disable any errors display on production, but can't do it.

I set YII_DEBUG to false, YII_ENV to prod, created light layout for errors. But can't avoid that message after template is rendered.

@pastuhov
Copy link
Author

@samdark & @cebe use mater/slave + time lag or ather problem

@samdark
Copy link
Member

samdark commented Jul 15, 2016

@pastuhov do you have master/slave for sessions?

@deadkrolik
Copy link

Example to reproduce issue:

  1. Add this code to controller's action
\Yii::$app->session->get('azaza');
return;
  1. Change user name for database connection.
  2. Set YII_DEBUG to false
  3. Refresh page

You will get the error Database Exception: SQLSTATE[42000] [1044] Access denied for user 'X'@'localhost' to database 'Y' at the and of page.

Disabling any errors is useful on production server. User shouldn't be able to see such detailed information for security reasons.

@samdark samdark added status:to be verified Needs to be reproduced and validated. and removed status:need more info labels Jul 26, 2016
@samdark samdark added this to the 2.0.x milestone Jul 26, 2016
@samdark
Copy link
Member

samdark commented Jul 26, 2016

I cannot reproduce that:

Error

@samdark
Copy link
Member

samdark commented Jul 26, 2016

Ah, indeed it's in the page source.

@samdark samdark added type:bug Bug and removed status:to be verified Needs to be reproduced and validated. labels Jul 26, 2016
@samdark samdark modified the milestones: 2.0.10, 2.0.x Jul 26, 2016
@samdark samdark self-assigned this Jul 26, 2016
@samdark
Copy link
Member

samdark commented Jul 26, 2016

Fixed. Thanks for helping with reproducing it.

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

No branches or pull requests

4 participants