@@ -277,6 +277,11 @@ PS_OPEN_FUNC(memcached)
277
277
PS_CLOSE_FUNC (memcached )
278
278
{
279
279
memcached_sess * memc_sess = PS_GET_MOD_DATA ();
280
+
281
+ if (!memc_sess ) {
282
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Session is not allocated, check session.save_path value" );
283
+ return FAILURE ;
284
+ }
280
285
281
286
if (MEMC_G (sess_locking_enabled )) {
282
287
php_memc_sess_unlock (memc_sess -> memc_sess );
@@ -307,6 +312,11 @@ PS_READ_FUNC(memcached)
307
312
memcached_sess * memc_sess = PS_GET_MOD_DATA ();
308
313
size_t key_length ;
309
314
315
+ if (!memc_sess ) {
316
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Session is not allocated, check session.save_path value" );
317
+ return FAILURE ;
318
+ }
319
+
310
320
key_length = strlen (MEMC_G (sess_prefix )) + key_len + 5 ; // prefix + "lock."
311
321
if (!key_length || key_length >= MEMCACHED_MAX_KEY ) {
312
322
php_error_docref (NULL , E_WARNING , "The session id is too long or contains illegal characters" );
@@ -339,6 +349,11 @@ PS_WRITE_FUNC(memcached)
339
349
memcached_return status ;
340
350
memcached_sess * memc_sess = PS_GET_MOD_DATA ();
341
351
size_t key_length ;
352
+
353
+ if (!memc_sess ) {
354
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Session is not allocated, check session.save_path value" );
355
+ return FAILURE ;
356
+ }
342
357
343
358
key_length = strlen (MEMC_G (sess_prefix )) + key_len + 5 ; // prefix + "lock."
344
359
if (!key_length || key_length >= MEMCACHED_MAX_KEY ) {
@@ -371,6 +386,11 @@ PS_DESTROY_FUNC(memcached)
371
386
{
372
387
memcached_sess * memc_sess = PS_GET_MOD_DATA ();
373
388
389
+ if (!memc_sess ) {
390
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Session is not allocated, check session.save_path value" );
391
+ return FAILURE ;
392
+ }
393
+
374
394
memcached_delete (memc_sess -> memc_sess , key -> val , key -> len , 0 );
375
395
if (MEMC_G (sess_locking_enabled )) {
376
396
php_memc_sess_unlock (memc_sess -> memc_sess );
0 commit comments