-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.1][FrameworkBundle] Allow configuration of session garbage collection #3659
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
Conversation
…or session 'keep-alive'.
@@ -90,6 +90,9 @@ | |||
<!-- end of deprecated attributes --> | |||
<xsd:attribute name="cache-limiter" type="xsd:string" /> | |||
<xsd:attribute name="auto-start" type="xsd:boolean" /> | |||
<xsd:attribute name="gc-maxlifetime" type="xsd:integer" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should xsd:string
(to allow %lifetime%
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, but I dont follow. Also please note this is very important that this lifetime is not confused with other lifetimes (like cookie lifetime) for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is: do we want to allow integers only or would parameters be fine also ("lifetime" is a generic name above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's kind of terrible because it seems PHP's configuration ini takes strings and casts them as required which is kind of nasty. If you set something boolean when you retrieve the values you get back string integers on ini_get(). So the question is how much validation do we want, since these would have to be "integer strings" if you catch my drift.
I think if Symfony2 doesnt allow %string%
replacements for integer fields, then that's something that should be looked at quite honestly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really get your point here. My concern is not with .ini or sf2 but with the xsd only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but it would mean for string replacements, everything has to be marked as string, which means you lose a big part of the validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Drak The validation is already performed properly by the Configuration class, using the processed value (meaning that you can validate as an integer there and use %lifetime%
to use a parameter). The XSD validation occurs way too early to be able to be strict (which is also why we cannot use required
in the XSD for required params for instance because they are required in one config file, not in each config file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK so basically all fields can/should be xsd:string
and it's sorted out in the configuration class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, XSD files are not used to perform the actual validation as the Config system is far more powerful for this. The main goal of providing an XSD is for IDE auto-completion for guys choosing XML for their app-level config (and they are probably a minority). Thus, if an error occurs during the XSD validation, the exception thrown to the user is pretty cryptic which is generally a WTF ("what does this stuff mean ?")
I'm wondering if it makes sense to continue maintaining them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof - thanks for the clarification, I'll make the necessary changes this PR.
@fabpot - this PR is ready for merge. It basically allows configuration of some session ini values that are necessary in controlling the session behaviour. |
@Drak shouldn't all the options here: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L266 be available for configuration, or am I just reading the source wrong and they already are? In this case should I make a separate PR to cover the rest or could you do it in this one? |
@Drak: the discussion is the ticket is very interesting and I think it should be part of a cookbook in the documentation. Can you take care of that before I merge this PR? Thanks. |
@fabpot - yes - it's on the todo list. Will update this PR when done. |
@fabpot - this is ready for merging, the documentation is done (the PR is in but I'll tweak it, but no need to wait to merge this PR). I will also add something extra to cookbook (I wrote docs for the component). |
Commits ------- cdba4cf [FrameworkBundle] Change XSD to allow string replacements on session args. 52f7955 [FrameworkBundle] Remove default from gc_* session configuration keys. 749593d [FrameworkBundle] Allow configuration of session garbage collection for session 'keep-alive'. Discussion ---------- [2.1][FrameworkBundle] Allow configuration of session garbage collection Bug fix: no Feature addition: yes Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: #2171 Todo: - --------------------------------------------------------------------------- by drak at 2012-03-21T21:56:20Z @fabpot - this PR is ready for merge. It basically allows configuration of some session ini values that are necessary in controlling the session behaviour. --------------------------------------------------------------------------- by dlsniper at 2012-03-21T22:57:18Z @Drak shouldn't all the options here: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L266 be available for configuration, or am I just reading the source wrong and they already are? In this case should I make a separate PR to cover the rest or could you do it in this one? --------------------------------------------------------------------------- by fabpot at 2012-03-23T14:56:22Z @Drak: the discussion is the ticket is very interesting and I think it should be part of a cookbook in the documentation. Can you take care of that before I merge this PR? Thanks. --------------------------------------------------------------------------- by drak at 2012-03-25T15:32:59Z @fabpot - yes - it's on the todo list. Will update this PR when done. --------------------------------------------------------------------------- by drak at 2012-03-26T19:45:13Z @fabpot - this is ready for merging, the documentation is done (the PR is in but I'll tweak it, but no need to wait to merge this PR). I will also add something extra to cookbook (I wrote docs for the component).
@Drak please see my above comment, #3659 (comment) , I can start working on a PR for this if you want, should be fairly straight forward. What do you think? |
@dlsniper I have no strong objections, except that some of the options, in the context of Sorry for my late reply, just had a lot on my plate. |
@Drak yeah, no worries. I know for example we were forced to use auto_start in our application because of strange behavior in the previous implementation of session (before your changes) hence my asking out it. Thank you again for your time and the great contributions you've made for Sf2 so far :) |
Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2171
Todo: -