@@ -215,7 +215,7 @@ static zend_result ps_mm_key_exists(ps_mm *data, const zend_string *key)
215215}
216216
217217const ps_module ps_mod_mm = {
218- PS_MOD_SID (mm )
218+ PS_MOD (mm )
219219};
220220
221221#define PS_MM_DATA ps_mm *data = PS_GET_MOD_DATA()
@@ -346,26 +346,7 @@ PS_READ_FUNC(mm)
346346
347347 mm_lock (data -> mm , MM_LOCK_RD );
348348
349- /* If there is an ID and strict mode, verify existence */
350- if (PS (use_strict_mode )
351- && ps_mm_key_exists (data , key ) == FAILURE ) {
352- /* key points to PS(id), but cannot change here. */
353- if (key ) {
354- efree (PS (id ));
355- PS (id ) = NULL ;
356- }
357- PS (id ) = PS (mod )-> s_create_sid ((void * * )& data );
358- if (!PS (id )) {
359- return FAILURE ;
360- }
361- if (PS (use_cookies )) {
362- PS (send_cookie ) = true;
363- }
364- php_session_reset_id ();
365- PS (session_status ) = php_session_active ;
366- }
367-
368- sd = ps_sd_lookup (data , PS (id ), false);
349+ sd = ps_sd_lookup (data , key , false);
369350 if (sd ) {
370351 * val = zend_string_init (sd -> data , sd -> datalen , false);
371352 ret = SUCCESS ;
@@ -488,4 +469,23 @@ PS_CREATE_SID_FUNC(mm)
488469 return sid ;
489470}
490471
472+ /*
473+ * Check session ID existence for use_strict_mode support.
474+ * PARAMETERS: PS_VALIDATE_SID_ARGS in php_session.h
475+ * RETURN VALUE: SUCCESS or FAILURE.
476+ *
477+ * Return SUCCESS for valid key(already existing session).
478+ * Return FAILURE for invalid key(non-existing session).
479+ * *mod_data, *key are guaranteed to have non-NULL values.
480+ */
481+ PS_VALIDATE_SID_FUNC (mm )
482+ {
483+ PS_MM_DATA ;
484+
485+ mm_lock (data -> mm , MM_LOCK_RD );
486+ zend_result ret = ps_mm_key_exists (data , key )
487+ mm_unlock (data -> mm );
488+ return ret ;
489+ }
490+
491491#endif
0 commit comments