fix session restart on PHP 5.3

this also removes some useless code
bug #12961 fix session restart on PHP 5.3 (Tobion)

This PR was merged into the 2.3 branch.

Discussion
----------

fix session restart on PHP 5.3

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | #12562
| License       | MIT
| Doc PR        | -

this also removes some useless code

Commits
-------

b9d3c92 fix session restart on PHP 5.3