Re: [RFC] Object oriented session handlers
| From: | Felipe Pena | Date: | Sun, 03 Jul 2011 15:15:01 +0000 |
| Subject: | Re: [RFC] Object oriented session handlers | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53735@lists.php.net to get a copy of this message | ||
Hi,
2011/6/2 Arpad Ray <arraypad@gmail.com>:
> Hi,
>
> A while ago I submitted a patch to allow session_set_save_handler() to
> accept a class, and support the inheritance of the default session
> handler's methods.
>
> The RFC has a more detailed description and the current patch:
> https://wiki.php.net/rfc/session-oo
>
> Changes since this was last discussed:
> - More sanity checking to prevent handlers being called in unexpected states
> - ZTS fixes
>
> Any thoughts?
>
> Regards,
>
> Arpad
I like the idea (and voted +1 on it), but I've some consideration to do:
+/* {{{ proto bool SessionHandler::open(string save_path, string session_name)
+ Wraps the old open handler */
+PHP_METHOD(SessionHandler, open)
+{
+ PS_SANITY_CHECK;
+
+ PS(mod_user_is_open) = 1;
+ RETVAL_LONG(PS(default_mod)->s_open(&PS(mod_data), PS(save_path),
PS(session_name) TSRMLS_CC));
+}
[..]
+ZEND_BEGIN_ARG_INFO(arginfo_session_class_open, 0)
+ ZEND_ARG_INFO(0, save_path)
+ ZEND_ARG_INFO(0, session_name)
+ZEND_END_ARG_INFO()
This method does not take the save_path and session_name parameter, it
just use the INI entry.
This lead to following behavior:
$x = new SessionHandler
$x->open(1,2,3,4); // param is not used, and no param check at all
It's missing void param check for the close method as well.
Thank you for helping us make PHP better. :)
--
Regards,
Felipe Pena