42464[!!!][TASK] Cleanup dual-use of auth_timeout_field in AbstractUserAuthentication
Commit message
Review
-
Code review CR +2
- Benni Mack +2
- Daniel Goerz +1
- Thomas Mayer +1
- Anja Leichsenring +1
-
Verified V +2
- Benni Mack +2
- Daniel Goerz +1
- Anja Leichsenring +1
Issues 1
Files 6
- typo3/sysext/backend/Classes/AjaxLoginHandler.php6+1 −1
- typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php17+30 −19
- typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php10+1 −1
- typo3/sysext/core/Classes/Core/Bootstrap.php1+1 −1
- typo3/sysext/core/Documentation/Changelog/master/Breaking-68890-RemoveDualuseOfAuthTimeoutField.rst6new+22 −0
- typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php4+10 −3
Review log 46
Show 21 earlier messages
-
Stefan Neufeind uploaded patch set 1 08/09/15, 18:32
-
Thomas Mayer commented on patch set 1 CR -1 08/10/15, 05:14
At least the naming should be fixed. Btw: Thank you so much for touching these classes!AjaxLoginHandler.php:121performance: are you not sure you get int?AjaxLoginHandler.php:122naming againAbstractUserAuthentication.php:134Which "Server" manages sessions? Is it the web server or is this a server-side session management / GC by TYPO3? Would also like to read what exactly happens after the timeout, e.g. "after the timeout the session is closed/GCed". When and how is the timeout reset?AbstractUserAuthentication.php:139Naming confusing: Reads as if the $session_timeout_server was a service serving session timeouts. As this is a public variable, naming plays a role here. $session_timeout should do or do we have client-side session timeouts (auto-logout)?AbstractUserAuthentication.php:146could be a breaking change if someone is checking with "=== 0" or "=== false" instead of "empty()" If it was not a public variable and another project, I'd prefer removing the default value here and using isset() instead.AbstractUserAuthentication.php:160andAbstractUserAuthentication.php:450Better use === comparison operator? If $this->session_timeout_server is not int, make it int (but not here).BackendUserAuthentication.php:256Should be "timeout" again (for consistency)BackendUserAuthentication.php:256What is meant with "Server" in this class?BackendUserAuthentication.php:258Really? That would be a dangerous misconfiguration.BackendUserAuthentication.php:261This is overriding an attribute we have already inherited from the abstract class just to set a different default value? Improvement: - use standard constructor to set default value (the way FrontendUserAuthentication is doing it) - Make SURE, SURE, SURE that nobody overwrites the standard constructor without calling the parent standard constructor - If that's the case, make sure you get the old behaviour Same applies for most other attributes of this class (check your IDE's override hints and don't trust the "visibility" todo's) Whatever is meant with the "visibility" todo's I hope we don't plan to use public Abstract class attributes and protected attributes in this class. I don't understand for which reason the standard constructor is not used here the way it is done in FrontendUserAuthentication. Visibility in terms of public/protected should not be the reason, that's pointless. Or, do we somewhere use parent attributes from the Abstract class? Alternative (IF you go for that, please do it consistently in all 3 classes): - Use constant in every class and in the abstract class with the same constant name e.g. SESSION_TIMEOUT_DEFAULT_VALUE. - Define attribute and set default value from constant - Don't define attribute again in inherited classes. When object is created, the default value is set from the constant. - Make sure you know the difference between self:: and static:: - WARNING: this is not the place to try this out.BackendUserAuthentication.php:261naming againBootstrap.php:1061naming again: It would just be consistent to use $this->session_timeout because it is ...['BE']['sessionTimeout'] and not ...['BE']['sessionTimeoutServer']FrontendUserAuthentication.php:142namingFrontendUserAuthentication.php:142this is much nicer than overriding the inherited attributeFrontendUserAuthentication.php:168naming -
Stefan Neufeind commented on patch set 1 08/10/15, 07:06
So you'd be for naming it "session_timeout" if I see right? How do we go about the 0 vs. empty string for the initialisation? If you can, please push a followup. Otherwise at least let's clarify the way to go.AjaxLoginHandler.php:121ReplyFrom the DB you might get a string here. Imho we should just be on the safe side to have a clean int here.AbstractUserAuthentication.php:139ReplyThe wording "timeout" was there already (although below it's called "lifetime" for the client-side). Imho the terms client and server (each one stores things related to the session used) are clear here.AbstractUserAuthentication.php:146ReplySo how do we handle it then? I'm aware it's a bit "risky". But at least we don't make it fully breaking (by providing the deprecation of this behaviour). I'd personally consider a type-strict comparison an edge-case. Imho we can't keep the default at 0 and tell the user that it should "never" be an int but a string instead. Using NULL was also an option I considered - but an empty string also has no better meaning here, so I decided we might treat NULL and '' equal.AbstractUserAuthentication.php:160Replyand?AbstractUserAuthentication.php:450Replyack. and it will always be int (it's the new property, with cleaned usage)AbstractUserAuthentication.php:926whitespaceBackendUserAuthentication.php:256Replysame as in the other caseBackendUserAuthentication.php:256ReplyackBackendUserAuthentication.php:258Replyalways was like that! -
Thomas Mayer commented on patch set 1 08/10/15, 09:47
Replied questions. Please, please keep going. You are doing a great job!AjaxLoginHandler.php:121ReplyIn that case it should be fixed somewhere else. It is performance related if we cast everywhere just because we cannot trust anything. The cast should be done at the code fragment which loads the data from the database. Not here. Nobody will ever remove this cast - for safety again.AbstractUserAuthentication.php:139ReplyNo, in line 139 the "_server" suffix should be removed: public $session_timeout = 0; Same applies for other occurences of "$session_timeout_server" in your contribution. It is crystally clear to me that an abstract user authentication class has a $session_timeout and not a $session_timeout_server. Does your car have a $wheel_motor? Ok, this is not so clear these days...AbstractUserAuthentication.php:146ReplyPersonally, I'm fine with your change. Just wanted to make clear this could be a breaking change breaking *now*. At least you should check all text occurences of "auth_timeout_field" in at least this git repository for safety (PhpStorm: "Find in path"). Actually I don't know how we handle potential breaking changes which are "unlikely" to have an effect. At least this should be documented somewhere in the changelog/release information. (again: personal opinion) Again, personal opinion: I'd rather like to see it actually break totally than to have slight changes over time that somehow have slightly different behaviour which nobody notices for a long time. E. g. an extension developer would know something is really wrong if errors appear in the logs when he or she is testing against a new typo3 release. Again, this is my personal opinion and not necessarily the opinion of typo3-core-developers. I'm not a core developer. If it's not properly documented for a production version, it could potentially be considered as a bug later (unexpected behaviour). All the jazz comes from the public variables and now there's no way to fix things unless it breaks something. getter/setter/check functions could handle this safely in most cases. The alternative "never touch" would be the worst scenario I could imagine. Better break and document. It's not so hard to use empty() for checks and even works with 6.2. How many extensions could be using this? I guess not so many...AbstractUserAuthentication.php:160ReplyThe "or" is semantically wrong here. Replace with "and" makes it better. I know this is not something you touched or claim to fix. I'm fine if you leave it for this commit. I'm fine if you change it.BackendUserAuthentication.php:258ReplyYes! Indeed, I reviewed a bit too much...Breaking-68890-RemoveDualuseOfAuthTimeoutField.rst:17Actually it IS breaking if someone uses "=== 0". And it is breaking NOW. Personally, I'm fine with that as long as it is documented.Breaking-68890-RemoveDualuseOfAuthTimeoutField.rst:17replace with "functionality"? -
Stefan Neufeind uploaded patch set 2 08/10/15, 10:26
-
Stefan Neufeind commented on patch set 1 08/10/15, 10:26
"session_timeout_server" renamed to just "session_timeout". Clarified/unified phpdoc for the properties a little.AjaxLoginHandler.php:121ReplyDone now in AbstractUserAuthentication.AbstractUserAuthentication.php:160ReplyOr is right here. If $gc_time is 0 it will use "the default" (session_timeout). As is obvious that doesn't really make sense in case session_timeout is 0 (no timeout) as it would mean no garbage-collection is ever done. Please note there is that session and session-data are two separate things! A session can be "permanent" but the session-data (contents of shopping-cart, ...) will by default be gone after 1 day. -
Thomas Mayer commented on patch set 2 CR +1 08/10/15, 10:46
Great! Thanks for you patience and for your contribution. -
Thomas Mayer commented on patch set 2 CR -1 08/10/15, 11:02
Sorry, documentation error found.Breaking-68890-RemoveDualuseOfAuthTimeoutField.rst:11"session_timeout" without "_server"Breaking-68890-RemoveDualuseOfAuthTimeoutField.rst:26"session_timeout" without "_server" -
Stefan Neufeind uploaded patch set 3 08/10/15, 11:21
-
Stefan Neufeind commented on patch set 3 08/10/15, 11:21
Thanks you spotted this. Of course phpStorm-refactoring didn't touch the rst-file for me ... makes sense :-) -
Thomas Mayer commented on patch set 3 CR +1 08/10/15, 11:47
Well done! -
Daniel Goerz voted on patch set 3 CR +1 09/10/15, 14:42
-
Benni Mack uploaded patch set 4 10/01/15, 13:09
-
Thomas Mayer voted on patch set 4 CR +1 10/01/15, 13:16
-
Andreas Kienast updated the commit message in patch set 5 10/01/15, 13:21
-
Thomas Mayer voted on patch set 5 CR +1 10/01/15, 13:30
-
Daniel Goerz voted on patch set 5 CR +1 10/04/15, 10:14
-
Benni Mack uploaded patch set 6 10/05/15, 10:17
-
Benni Mack voted on patch set 6 CR +1 10/05/15, 10:18
-
Thomas Mayer commented on patch set 6 CR -1 10/05/15, 10:50
It's unclear to me what patch set 6 has to do with the commit message.AjaxLoginHandler.php:37It's not clear to me what these actions have in common with the commit message -
Benni Mack commented on patch set 6 10/05/15, 11:12
please recheck just the simple patch (no compare between versoins). I just rebased the patch, as there other changes inAjaxLoginHandler today.
-
Thomas Mayer commented on patch set 6 CR 0 10/05/15, 13:19
I'm temporarily neutral. Even if this has been rebased for some reason, I cannot review against the commit message that way. -
Oliver Hader uploaded patch set 7 10/09/15, 00:06
-
Stefan Neufeind commented on patch set 6 10/15/15, 23:16
@Thomas: I'll be happy to answer questions, if you can please name some. As written in the description (and on forge) currently one field was used for both a reference to a field (giving a fieldname) or a timeout-value directly. That "dual-use" leads to the mixed field-type and we need to make sure whether we're currently comparing against a value (the actual timeout) or are given a fieldname. -
Thomas Mayer commented on patch set 7 10/18/15, 23:39
I just struggled with the rebased/restructured set of changes. I'd feel happier to diff against a recent upstream commit id when doing review on this. -
Stefan Neufeind commented on patch set 7 10/19/15, 07:22
@Thomas: Can you please explain where the problem is? Patchset 7 is against "recent" master and should apply cleanly. Or what do you mean? -
Thomas Mayer commented on patch set 7 CR +1 10/19/15, 17:16
@Stefan: Patch set 6 had additional changes which did not apply to the commit log message. The rebased Patch set 7 looks fine again. -
Benni Mack voted on patch set 7 CR +1 12/23/15, 21:03
-
Markus Klein commented on patch set 7 CR -1 12/23/15, 22:23
needs to be adjusted for CMS 8. Nothing to deprecate anymore.AbstractUserAuthentication.php:141why not calling it sessionTimeout?AbstractUserAuthentication.php:932remove that now.Breaking-68890-RemoveDualuseOfAuthTimeoutField.rstThe name of the file should be adjustedBreaking-68890-RemoveDualuseOfAuthTimeoutField.rst:16It's not deprecated in 7, but simply changed in 8. -
Oliver Klee commented on patch set 7 12/31/15, 10:19
AbstractUserAuthentication.php:141Reply+1 -
Benni Mack uploaded patch set 8 03/06/16, 00:31
-
Benni Mack voted on patch set 8 CR +1 03/06/16, 00:51
-
Thomas Mayer commented on patch set 8 CR +1 03/06/16, 00:54
Looks ok for me as long as we go for $session_timeout (for consistency) instead of $sessionTimeout (as proposed by Markus Klein). If this would be changed to $sessionTimeout any time soon it could indeed be done now for the new variable. -
Benni Mack commented on patch set 8 03/06/16, 00:54
I'll update it again with $sessionTimeout, gimme a minute -
Thomas Mayer commented on patch set 8 CR 0 03/06/16, 00:58
> I'll update it again with $sessionTimeout, gimme a minute Please also change the variable name in the changelog. -
Benni Mack uploaded patch set 9 03/06/16, 01:03
-
Benni Mack voted on patch set 9 CR +1 03/06/16, 01:03
-
Benni Mack voted on patch set 9 V +1 03/06/16, 01:04
-
Thomas Mayer commented on patch set 9 CR +1 03/06/16, 01:07
pretty ;-) -
Anja Leichsenring voted on patch set 9 CR +1 V +1 03/06/16, 09:58
-
Daniel Goerz voted on patch set 9 CR +1 03/06/16, 10:00
-
Daniel Goerz voted on patch set 9 V +1 03/06/16, 10:00
-
Benni Mack voted on patch set 9 CR +2 V +2 03/06/16, 10:01
-
Gerrit merged patch set 9 03/06/16, 10:01
-
Alexander Opitz commented on patch set 10 11/14/16, 13:58
BackendUserAuthentication.php:246Forgot to change Documentation?FrontendUserAuthentication.php:43Stupid Copy&Paste? -
Alexander Opitz commented on patch set 10 11/14/16, 14:17