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

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

diff --git a/NEWS b/NEWS
index 713b739d752354e2ac6f4ea119eea4a9a74ae136..cd84e755ffaae81e153015afab396be5f3b7daea 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, Version 4.4.4
+- Fixed bug #38377 (session_destroy() gives warning after
+  session_regenerate_id()). (Ilia)
 - Fixed bug #38322 (reading past array in sscanf() leads to arbitary code 
   execution). (Tony)
 - Fixed bug #38278 (session_cache_expire()'s value does not match phpinfo's 
index 06af01a13d55bf0c9406fa8e01239a450c8cc373..e1485d586eb9878d5aa08d7374bd7c35bb2ca200 100644 (file)
@@ -368,7 +368,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