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
can't write session on controller issue on 2.0.15.1 #16959
Comments
Thanks for posting in our issue tracker.
Thanks! This is an automated comment, triggered by adding the label |
How's your session configured? |
Session are configured to be write on database ('session' table by
default).
*Update -* It does write custom session to database but just can't retrieve
it.
Check the attached screenshot!
I tried to write 'filter' session by ajax call but i cannot able to
retrieve it on view and not on any other page after it redirect or refresh
it. It works fine if i roll back yii framework to old version.
Let me know, if attached screenshot make sense to you or not.
*Thanks,*
*Ashish Rawat*
On Tue, Dec 11, 2018 at 2:59 PM Alexander Makarov ***@***.***> wrote:
How's your session configured?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16959 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACFOh7bQ-GwROfc3suOuULUFLpnIhJUCks5u33rxgaJpZM4ZMQMf>
.
![screenshot from 2018-12-11 20-35-05](https://user-images.githubusercontent.com/2182791/49810437-3ec04380-fd87-11e8-983c-4486459c6f05.png)
![screenshot from 2018-12-11 20-34-18](https://user-images.githubusercontent.com/2182791/49810440-3ec04380-fd87-11e8-9d47-8cefd2ad16c3.png)
![screenshot from 2018-12-11 20-32-58](https://user-images.githubusercontent.com/2182791/49810442-3f58da00-fd87-11e8-8a1b-36fbbc9934ed.png)
![screenshot from 2018-12-11 20-31-03](https://user-images.githubusercontent.com/2182791/49810443-3ff17080-fd87-11e8-9257-0d9eacb6c5ad.png)
|
Which database is used? |
Mysql |
Anything in logs? |
@ashishrawat417 anything new about this issue? We'd like to sort this out before releasing 2.0.16. |
@ashishrawat417 Do you have multiple requests (eg. AJAX) which might overwrite their session data? |
Hi guys, I may have found this bug... commit: d165863 code line: https://github.com/yiisoft/yii2/blob/master/framework/web/DbSession.php#L224 is_array($fields['data'] && is_object($fields['data'])) it will always return |
And I think the method /**
* Method typecasts $fields before passing them to PDO.
* Default implementation casts field `data` to `\PDO::PARAM_LOB`.
* You can override this method in case you need special type casting.
*
* @param array $fields Fields, that will be passed to PDO. Key - name, Value - value
* @return array
* @since 2.0.13
*/
protected function typecastFields($fields)
{
...
return $fields;
} |
@SilverFire would you please take a look? |
@talentant thank you, the condition was obviously broken. I've fixed it and added test that checks that session override works, but it works even before my fix in @ashishrawat417 could you, please, check if patched worked for you and adjust test if it still does not work for you? |
Closing assuming it's fixed now. |
@ashishrawat417 please checking when you have a chance. |
So, I upgraded Yii Framework from version 2.0.12 to 2.0.15.1 and now i am facing session writing issue which was working fine on 2.0.12.
For example -
$session = \Yii::$app->session;
$session['filter'] = [
'filter_dealer' => 4,
];
Doesn't work which was working fine before i upgraded framework.
Permissions are correct. Also, tried to switching session from memcached to filecache and vice versa but didn't work.
UPDATE :
Its issue with yii\web\DbSession. Works fine with default yii\web\CacheSession
The text was updated successfully, but these errors were encountered: