]> granicus.if.org Git - php/commitdiff
Fixed bug #74936 - session_*() functions trigger a warning in read mode when the...
authorSergei Morozov <morozov@tut.by>
Mon, 17 Jul 2017 09:39:34 +0000 (12:39 +0300)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 18 Jul 2017 20:25:22 +0000 (22:25 +0200)
NEWS
ext/session/session.c
ext/session/tests/bug74936.phpt [new file with mode: 0644]
ext/session/tests/session_cache_expire_basic.phpt
ext/session/tests/session_cache_expire_variation1.phpt
ext/session/tests/session_cache_expire_variation2.phpt
ext/session/tests/session_cache_expire_variation3.phpt
ext/session/tests/session_cache_limiter_variation1.phpt
ext/session/tests/session_cache_limiter_variation2.phpt
ext/session/tests/session_save_path_variation1.phpt

diff --git a/NEWS b/NEWS
index fe44c45b1716372c9d67732cbd2e374b0e2fe4a6..7ef1302edc9312d0188053183f35d55f2f6278f4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,11 @@ PHP                                                                        NEWS
 - Session:
   . Fixed bug #74892 (Url Rewriting (trans_sid) not working on urls that start
     with "#"). (Andrew Nester)
+  . Fixed bug #74936 (session_cache_expire/cache_limiter/save_path() trigger a
+    warning in read mode). (morozov)
+
+- SPL:
+  . Fixed bug #74669 (Unserialize ArrayIterator broken). (Andrew Nester)
 
 20 Jul 2017, PHP 7.2.0beta1
 
index 70f56a3adeee96c09d0ba9d4ba3e726acb4694a6..1e8321d1ac2bb86f9bd479319d270cbe9dc8c82f 100644 (file)
@@ -1999,7 +1999,7 @@ static PHP_FUNCTION(session_save_path)
                return;
        }
 
-       if (PS(session_status) == php_session_active) {
+       if (name && PS(session_status) == php_session_active) {
                php_error_docref(NULL, E_WARNING, "Cannot change save path when session is active");
                RETURN_FALSE;
        }
@@ -2227,7 +2227,7 @@ static PHP_FUNCTION(session_cache_limiter)
                return;
        }
 
-       if (PS(session_status) == php_session_active) {
+       if (limiter && PS(session_status) == php_session_active) {
                php_error_docref(NULL, E_WARNING, "Cannot change cache limiter when session is active");
                RETURN_FALSE;
        }
@@ -2258,7 +2258,7 @@ static PHP_FUNCTION(session_cache_expire)
                return;
        }
 
-       if (PS(session_status) == php_session_active) {
+       if (expires && PS(session_status) == php_session_active) {
                php_error_docref(NULL, E_WARNING, "Cannot change cache expire when session is active");
                RETURN_LONG(PS(cache_expire));
        }
diff --git a/ext/session/tests/bug74936.phpt b/ext/session/tests/bug74936.phpt
new file mode 100644 (file)
index 0000000..aee7493
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Bug #74936 session_cache_expire() triggers a warning in read mode.
+--SKIPIF--
+<?php
+include('skipif.inc');
+?>
+--FILE--
+<?php
+
+session_start();
+var_dump(session_cache_expire());
+var_dump(session_cache_limiter());
+var_dump(session_save_path());
+?>
+===DONE===
+--EXPECT--
+int(180)
+string(7) "nocache"
+string(0) ""
+===DONE===
index fb240006e7c30e425c414fb2419ff1ea948494cc..716648593798996979324682398f066166e4fbe9 100644 (file)
@@ -32,8 +32,6 @@ int(180)
 int(180)
 int(1234567890)
 bool(true)
-
-Warning: session_cache_expire(): Cannot change cache expire when session is active in %s on line 17
 int(180)
 bool(true)
 int(180)
index 1a7324935fa718ba69850465dc7c395d3e058d50..9d0ba27fea148bfada53307b4375c1d04019c665 100644 (file)
@@ -34,8 +34,6 @@ int(360)
 int(360)
 int(1234567890)
 bool(true)
-
-Warning: session_cache_expire(): Cannot change cache expire when session is active in %s on line 17
 int(180)
 bool(true)
 int(180)
index c3daae6c5567c07823129a4817b30b4f66a67dc5..f17f4711a903014b441ab6ba8b187a54d357b94b 100644 (file)
@@ -33,8 +33,6 @@ int(360)
 int(360)
 int(1234567890)
 bool(true)
-
-Warning: session_cache_expire(): Cannot change cache expire when session is active in %s on line 18
 int(180)
 bool(true)
 int(180)
index d9f78df491293027ed566afb445354e6234bfb1c..c243c1f1156d81454195d94ac0609430144c0580 100644 (file)
@@ -38,8 +38,6 @@ string(3) "180"
 int(180)
 string(10) "1234567890"
 bool(true)
-
-Warning: session_cache_expire(): Cannot change cache expire when session is active in %s on line 19
 int(1234567890)
 string(10) "1234567890"
 bool(true)
index 7ba621120ddca88d4f2504471d03dc690af54fa9..5af208a9099bf5f90639a2485036ea4ea17b092c 100644 (file)
@@ -32,15 +32,11 @@ ob_end_flush();
 *** Testing session_cache_limiter() : variation ***
 string(7) "nocache"
 bool(true)
-
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 15
-bool(false)
+string(7) "nocache"
 
 Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 16
 bool(false)
-
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 17
-bool(false)
+string(7) "nocache"
 bool(true)
 string(7) "nocache"
 Done
index 94571017e18005926b87ed195388d8b5f302c5c5..eb63d99dac5b23bff37611f9caf52319dfbbde63 100644 (file)
@@ -31,15 +31,11 @@ ob_end_flush();
 *** Testing session_cache_limiter() : variation ***
 string(7) "nocache"
 bool(true)
-
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 16
-bool(false)
+string(7) "nocache"
 
 Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 17
 bool(false)
-
-Warning: session_cache_limiter(): Cannot change cache limiter when session is active in %s on line 18
-bool(false)
+string(7) "nocache"
 bool(true)
 string(7) "nocache"
 Done
index 7f7130dfb006c1433987dfe8819676eac9f561ce..75533c810024ddeedce016aa5dc74af30b9b9c28 100644 (file)
@@ -42,15 +42,11 @@ string(0) ""
 string(0) ""
 string(%d) "%stests"
 bool(true)
-
-Warning: session_save_path(): Cannot change save path when session is active in %s on line 19
-bool(false)
+string(%d) "%stests"
 
 Warning: session_save_path(): Cannot change save path when session is active in %s on line 20
 bool(false)
-
-Warning: session_save_path(): Cannot change save path when session is active in %s on line 21
-bool(false)
+string(%d) "%stests"
 bool(true)
 string(%d) "%stests"
 Done