Skip to content

Conversation

@neznaika0
Copy link
Contributor

Description

  • Deprecations in Session have been removed.
  • Unnecessary phpdocs have been cleared, dots have been added.
  • Notes in changelog.
  • Updated documentation, added examples.
  • Fixed some phpstan errors
  1. Since I haven't used any handlers other than FileHandler, what should I add to the guide about cleaning up old sessions? While I was reviewing the commit, I remembered about GC. Can I add information about him?
  2. Where do these properties come from?
------ -------------------------------------------------------------------------------------- 
  Line   system/Session/Handlers/RedisHandler.php                                             
 ------ -------------------------------------------------------------------------------------- 
  :99    Access to an undefined property Config\Session::$lockWait.                           
         🪪  property.notFound                                                                
         💡  Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property                                                                                    
  :100   Access to an undefined property Config\Session::$lockAttempts.                       
         🪪  property.notFound                                                                
         💡  Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property  
  1. With each update, the documentation gets confusing. We add various notes and it spoils the overall readability.
    I have removed the stop() method - it is not needed for the v4.7 documentation, but people reading for v4.3 should know about it. For good measure, we need to switch to a different version system for the guide. At least clear the notes for major versions 4.4, 4.5, 4.6...

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Copy link
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

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

  1. If you're referring to manually removing old session data, then yes. If you're referring to the PHP session GC mechanism, then no.

  2. That is clearly a mistake. It should use the same property names as the fallback, but loaded from the config file.

  3. I don't think we will make that change now. Maybe in the new docs, if we eventually migrate. Users on older CI versions can always download the appropriate version of the user guide from the userguide repository.

chmod 0700 /<path to your application directory>/writable/sessions/
chown www-data /<path to your application directory>/writable/sessions/
Since the built-in mechanism does not have automatic cleaning of expired sessions,
Copy link
Member

Choose a reason for hiding this comment

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

Not 100% true, since we can use PHP's GC mechanism when using a file or database handler, although it's not recommended. In general, cleaning expired sessions manually is recommended for both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's rephrase it. I know that the default garbage collector is unlikely to work. To make it work, you need to set up a session.gc_probability session.gc_divisor.
In my test projects, the sessions dir is constantly full. Even if I restart the server after a week, the garbage collector does not fire.

Copy link
Member

Choose a reason for hiding this comment

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

It will only be triggered very rarely unless we set a higher probability - that's all. It works fine, but it's not recommended for production use, especially when using the file handler.

I'm still not entirely sure which option you want to describe.

@michalsn michalsn added refactor Pull requests that refactor code 4.7 labels Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.7 refactor Pull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants