]> granicus.if.org Git - php/commitdiff
MFB: Fixed bug #38377 (session_destroy() gives warning after
authorIlia Alshanetsky <iliaa@php.net>
Tue, 8 Aug 2006 14:57:33 +0000 (14:57 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 8 Aug 2006 14:57:33 +0000 (14:57 +0000)
session_regenerate_id()).

ext/session/mod_files.c
ext/session/tests/bug38377.phpt [new file with mode: 0644]

index c4ae79310c4c61e0ae885149008f62f698142c1b..c72997e2c6d2b34308fab30344dfc11030078378 100644 (file)
@@ -402,7 +402,12 @@ PS_DESTROY_FUNC(files)
                ps_files_close(data);
        
                if (VCWD_UNLINK(buf) == -1) {
-                       return FAILURE;
+                       /* This is a little safety check for instances when we are dealing with a regenerated session
+                        * that was not yet written to disk
+                        */
+                       if (!VCWD_ACCESS(buf, F_OK)) {
+                               return FAILURE;
+                       }
                }
        }
 
diff --git a/ext/session/tests/bug38377.phpt b/ext/session/tests/bug38377.phpt
new file mode 100644 (file)
index 0000000..514e459
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+bug #38377 (session_destroy() gives warning after session_regenerate_id())
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php
+session_start();
+session_regenerate_id();
+session_destroy();
+echo "Done\n";
+?>
+--EXPECT--
+Done