Review main Merged

96272[TASK] Read the current session after authentication validation

Wouter Wolters CR +2 V +2 Easy +3 −14 updated 10/14/26, 11:52

Commit message

Session validation can replace the user session, for example when
an expired session becomes anonymous. Read the current session into
a local variable before checking its new and anonymous flags.

This prevents PHPStan from reusing the earlier isNew() result across
validation. Keep both guards and remove the two matching baseline
occurrences without changing authentication behavior.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Markus Klein +1
    • Josua Vogel +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Markus Klein +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1517

  1. Wouter Wolters uploaded patch set 1 10/01/26, 18:59

  2. Wouter Wolters updated the commit message in patch set 2 10/09/26, 18:00

  3. Wouter Wolters rebased onto patch set 3 10/09/26, 18:00

  4. Wouter Wolters wrote 10/09/26, 18:00

    Unset private
  5. Wouter Wolters marked it ready for review 10/09/26, 18:00

  6. core-ci voted on patch set 3 V +1 10/09/26, 18:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110668

  7. Josua Vogel voted on patch set 3 CR +1 10/09/26, 19:33

  8. Wouter Wolters uploaded patch set 4 CR +1 V +1 10/12/26, 20:18

  9. Josua Vogel voted on patch set 4 CR +1 10/12/26, 20:22

  10. core-ci voted on patch set 4 V +1 10/12/26, 20:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110950

  11. Markus Klein commented on patch set 4 10/12/26, 21:24

    I don't get it. The example does not make sense to me. And why does PHPStan complain about `$this->somevar` but not with `$somevar = $this->somevar` ?
  12. Oliver Klee voted on patch set 4 CR +1 V +1 10/13/26, 13:39

  13. Wouter Wolters commented on patch set 4 10/13/26, 16:53

    Reply

    That has to do with how PHPstan remembers things when visiting the code. See https://phpstan.org/blog/remembering-and-forgetting-returned-values In this case isNew() initially returns false, so we enter the outer if. fetchValidUserFromSessionOrDestroySession() detects the expiry, calls logoff() and then createAnonymousSession(). createAnonymousSession() replaces $this->userSession with a new session whose isNew() returns true.
  14. Simon Schaufelberger voted on patch set 4 CR +1 V +1 10/13/26, 16:59

  15. Markus Klein voted on patch set 4 CR +1 V +1 10/13/26, 21:05

  16. Benni Mack voted on patch set 4 CR +2 V +2 10/14/26, 11:52

  17. Benni Mack merged patch set 5 10/14/26, 11:52