Giter VIP home page Giter VIP logo

session's People

Contributors

dependabot[bot] avatar devanych avatar dood- avatar fantom409 avatar iamsaint avatar luizcmarin avatar roxblnfk avatar rustamwin avatar samdark avatar sankaest avatar terabytesoftw avatar thenotsoft avatar viktorprogger avatar vjik avatar xepozz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

session's Issues

SessionMiddleware can not work on swoole

Hi guys,my application run with swoole, I found I can not use SessionMiddleware because Session will be overwrite by other request.
Could we add Session into attribute of request, so we can use the way $request->getAttribute(SessionInterface::class) to get Session.
We also can remain old usage by add a new property when application running different env.

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar

Docs: Session without SessionMiddleware

At the moment, the Session class cannot function on its own without SessionMiddleware, since the Session::setId method must be called to work correctly with sessions.

I suggest adding a section to [README.md] (/yiisoft/session/blob/master/README.md):

Using Session without SessionMiddleware

If you want to use the functionality of the Session class without the SessionMiddleware class, you need to get the session identifier yourself (from the request) when creating the Session instance (or before using it for the first time) and pass it to the Session class instance via the Session::setId method.


На данный момент класс Session не может функционировать самостоятельно без SessionMiddleware, так как для корректной работы с сессиями требуется вызов метода Session::setId.

Предлагаю добавить в README.md раздел:

Использование Session без SessionMiddleware

Если вы хотите использовать функционал класса Session без класса SessionMiddleware, вам необходимо при создании экземпляра Session (или до первого его использования), самостоятельно получить идентификатор сессии (из запроса) и передать его в экземпляр класса Session через метод Session::setId.

Optimizing read operations from an uncreated session

I suggest not to open a session for reading / clearing session data if the session ID is not set.

The absence of a session identifier indicates that there is no saved session. In this case, there is no need to create an empty session when reading data.

For example, when reading flash messages, this functionality will no longer start a session if it was not there before.

Add docs

Currently it is not documented enough and what's documented is Yii-specific.

  1. Need a general installation guide.
  2. Need either a reference to Yii guide on sessions or expanded description of opening and closing session, working with session data, implementing a custom storage, and using flash messages.

Calling $session->close() for the first request doesn't set up cookie

Prerequisite:
There is no session cookie set up for the domain using for test.

Steps to reproduce:
Add SessionMiddleware to the middlewares used by the application

In the controller call:

  1. $session->open();
  2. $session->set('key', 'value');
  3. $session->close();

Expected result: there is a Set-Cookie header (PHPSESSID) in the response.

Actual result: there is no Set-Cookie header in the response.

It is said in the documentation:

Note: Closing session as early as possible is a good practice since many session implementations are blocking other requests while session is open.

It shoud be either fixed in the documentation to forbid closing session manually, or should be fixed in the code to send a cookie for a manually closed session.

Customs session names are broken

What steps will reproduce the problem?

$v = new \Yiisoft\Session\Session([
    'name' => 'customname',
]);

What is the expected result?

Yiisoft\Session\Session::getName would return $this->options['name] if available (or first check whether there’s an active session) before resorting to session_name().

What do you get instead?

a fresh session and new session cookie each response

Additional info

session_name() always returns PHPSESSID when there’s been no session started yet.

Q A
Version 1.1.0
PHP version 7.4
Operating system Debian GNU/Linux 11

Can not do mutation testing

Currently custom PHPUnit formatter is used since standard PHP session engine writes to stdout and it can't do so twice.

It seems Infection can not use custom formatter so I've found no way to run mutation tests so far.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.