@@ -154,16 +154,6 @@ PS_OPEN_FUNC(memcached)
154154 status = memcached_server_push (memc_sess -> memc_sess , servers );
155155 memcached_server_list_free (servers );
156156
157- if (MEMC_G (sess_prefix ) && MEMC_G (sess_prefix )[0 ] != 0 && memcached_callback_set (memc_sess -> memc_sess , MEMCACHED_CALLBACK_PREFIX_KEY , MEMC_G (sess_prefix )) != MEMCACHED_SUCCESS ) {
158- PS_SET_MOD_DATA (NULL );
159- if (plist_key ) {
160- efree (plist_key );
161- }
162- memcached_free (memc_sess -> memc_sess );
163- php_error_docref (NULL TSRMLS_CC , E_WARNING , "bad memcached key prefix in memcached.sess_prefix" );
164- return FAILURE ;
165- }
166-
167157 if (status == MEMCACHED_SUCCESS ) {
168158 goto success ;
169159 }
@@ -211,6 +201,13 @@ PS_OPEN_FUNC(memcached)
211201 return FAILURE ;
212202 }
213203 }
204+
205+ if (MEMC_G (sess_prefix ) && MEMC_G (sess_prefix )[0 ] != 0 ) {
206+ if (memcached_callback_set (memc_sess -> memc_sess , MEMCACHED_CALLBACK_PREFIX_KEY , MEMC_G (sess_prefix )) != MEMCACHED_SUCCESS ) {
207+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "bad memcached key prefix in memcached.sess_prefix" );
208+ return FAILURE ;
209+ }
210+ }
214211#ifdef HAVE_MEMCACHED_SASL
215212 if (MEMC_G (use_sasl )) {
216213 /*
@@ -331,7 +328,11 @@ PS_READ_FUNC(memcached)
331328 * vallen = payload_len ;
332329 free (payload );
333330 return SUCCESS ;
331+ } else if (status == MEMCACHED_NOTFOUND ) {
332+ /* this is okey, session may not be in memcached yet */
333+ return FAILURE ;
334334 } else {
335+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "error getting session from memcached: %s" , memcached_last_error_message (memc_sess -> memc_sess ));
335336 return FAILURE ;
336337 }
337338}
@@ -371,6 +372,7 @@ PS_WRITE_FUNC(memcached)
371372 if (status == MEMCACHED_SUCCESS ) {
372373 return SUCCESS ;
373374 } else {
375+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "error saving session to memcached: %s" , memcached_last_error_message (memc_sess -> memc_sess ));
374376 write_try_attempts -- ;
375377 }
376378 } while (write_try_attempts > 0 );
0 commit comments