# [RFC DISCUSSION] User defined session serializer

- Thread: https://externals.io/message/96944
- Original archive: https://news-web.php.net/php.internals/96944
- Started by Yasuo Ohgaki on 2016-11-17T10:55:02+00:00
- Messages: 4
- RFC: User defined session serializer (Declined) — https://externals.io/rfc/user_defined_session_serializer.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #96944 — Yasuo Ohgaki — 2016-11-17T10:55:02+00:00

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

Hi all,

Session module implements serialize handler as module.
This RFC is to expose it to user space.

RFC
https://wiki.php.net/rfc/user_defined_session_serializer

PR
https://github.com/php/php-src/pull/2205

Comments are appreciated!

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #97009 — Markus Fischer — 2016-11-19T00:02:59+00:00

URL: https://externals.io/message/96944#97009 · In reply to: #96944

Hello,


> 
> Session module implements serialize handler as module.
> This RFC is to expose it to user space.
> 
> RFC
> https://wiki.php.net/rfc/user_defined_session_serializer
> 
> PR
> https://github.com/php/php-src/pull/2205
> 
> Comments are appreciated!

Well, I like it. It's sometimes necessary to share session state with
non-PHP application and this is IMHO a welcome addition to ease the
exchange.

Btw, what is the proper way to signal a problem during
serialization/unserialization? I couldn't figure it out from the RFC nor
the PR and there doesn't seem to be a test case for it.
Return null/false? Throw an exception?

thanks,
- Markus

---

## #97019 — Yasuo Ohgaki — 2016-11-19T04:15:01+00:00

URL: https://externals.io/message/96944#97019 · In reply to: #97009

Hi Markus,


> 
> > […]
>
> Well, I like it. It's sometimes necessary to share session state with
> non-PHP application and this is IMHO a welcome addition to ease the
> exchange.
>
> Btw, what is the proper way to signal a problem during
> serialization/unserialization? I couldn't figure it out from the RFC nor
> the PR and there doesn't seem to be a test case for it.
> Return null/false? Throw an exception?

It raises `E_RECOVERABLE_ERROR` currently. I choose it because session
module raises errors.  However, I prefer to use exception over error.
I'll create a RFC to adopt exception for session.

Thank you for feedback about tests, I'll add error case tests.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #97229 — Yasuo Ohgaki — 2016-11-30T05:31:14+00:00

URL: https://externals.io/message/96944#97229 · In reply to: #97019

Hi Markus,


> > […]

I added test and add return value description in RFC sample code.
Serialize function should return "string".
Unserialize function should return "array".
Anything other data type raises E_RECOVERABLE_ERROR, so returning
 `FALSE` would be the reasonable choice to indicate error condition.

To all,

If there is no additional comment, I'll start vote in a few days.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net
