# Bug #52477

- Thread: https://externals.io/message/50126
- Original archive: https://news-web.php.net/php.internals/50126
- Started by Alexandr Verbitsky on 2010-11-08T13:33:03+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #50126 — Alexandr Verbitsky — 2010-11-08T13:33:03+00:00

URL: https://externals.io/message/50126#50126

Hi all.
I am investigate in the reason Bug #52477 (http://bugs.php.net/52477) 
and found that it appear because in PHP 5.2.14 there are two constant 
PS_DELIMITER and PS_UNDEF_MARKER. The value it's constants not allow to 
use in the root key of SESSION elements.
Also in the version 5.2.0 was Bug #40274 (http://bugs.php.net/40274). 
For its decision the code has been added in PS_ENCODE_LOOP to pass 
elements with numerical keys.

I not understand for what is necessary special algorithm for serialize 
roots elements. Why dont using php_get_session_var and 
php_var_unserialize functions for PS(http_session_vars) directly? Where 
i can read about it in manual?

---

## #50129 — Arpad Ray — 2010-11-08T19:12:12+00:00

URL: https://externals.io/message/50126#50129 · In reply to: #50126

On Mon, Nov 8, 2010 at 1:33 PM, Alexandr Verbitsky
<verbitsky_alexandr@mail.by> wrote:
> Hi all.
> I am investigate in the reason Bug #52477 (http://bugs.php.net/52477) and
> found that it appear because in PHP 5.2.14 there are two constant
> PS_DELIMITER and PS_UNDEF_MARKER. The value it's constants not allow to use
> in the root key of SESSION elements.
> Also in the version 5.2.0 was Bug #40274 (http://bugs.php.net/40274). For
> its decision the code has been added in PS_ENCODE_LOOP to pass elements with
> numerical keys.
>
> I not understand for what is necessary special algorithm for serialize roots
> elements. Why dont using php_get_session_var and php_var_unserialize
> functions for PS(http_session_vars) directly? Where i can read about it in
> manual?

Hi,

The special algorithm was necessary because the root keys could be
used in session_register() as global variables, which have certain
naming restrictions. This is no longer necessary since
session_register() has been deprecated.

I wrote a patch a while ago to use php_var_serialize but the
complication emerged of adding a version number to the serialized
string (otherwise migrating existing sessions is awkward). I haven't
had time to work on it but can dig up the latest code if you'd like,
it will be another few weeks until I can pick it up again.

Regards,

Arpad
