[php-src] PR #25950: ext/session: Reject non-array php_serialize session data
| From: | jorgsowa | Date: | Mon, 30 Nov 2026 16:09:48 +0000 |
| Subject: | [php-src] PR #25950: ext/session: Reject non-array php_serialize session data | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41258@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25950
Author: jorgsowa
With
session.serialize_handler=php_serialize, stored data whose top-level value
isn't an array (i:1;, s:3:"abc";, b:1;, N;, an object) was accepted and
became $_SESSION as that type. Decoding reported success, and writes were then silently
skipped, so the bad record stayed in storage.
That data now takes the same path as data that can't be unserialized: $_SESSION is
reset to an empty array, decoding fails with "Failed to decode session object. Session
has been destroyed", and the session is destroyed. This matches the php and
php_binary handlers, which can only ever produce an array. Valid sessions are
unaffected, including a reference-wrapped array.
I point master branch as hardening suggestion.