Revert "Merge pull request #4405 from php-engineer/master-session-bugfix"

This reverts commit 5863adda424b3f0f513436176608ea376af1c294, reversing
changes made to 4c37cf6d4b9ed740ed157a8a5089c6b76914def4.

There was no real issue. The lack of session cookie in CLI makes writing
tests a bit tricky which caused the confusion. Refs #4405, #4451.