mirror of
https://github.com/php/php-src.git
synced 2026-04-27 18:23:26 +02:00
383ff8c63f
When session.cookie_lifetime was set to a value larger than maxcookie, OnUpdateCookieLifetime returned SUCCESS without updating the internal long value, causing ini_get() string and PS(cookie_lifetime) to go out of sync. We now properly parse the string value of the ini setting and fail when it is not an integer string or is not within the expected range.
32 lines
704 B
PHP
32 lines
704 B
PHP
--TEST--
|
|
Test session_set_cookie_params() function : negative and 0 lifetime
|
|
--EXTENSIONS--
|
|
session
|
|
--SKIPIF--
|
|
<?php include('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
ob_start();
|
|
|
|
var_dump(ini_get("session.cookie_lifetime"));
|
|
var_dump(session_set_cookie_params(["lifetime" => 0]));
|
|
var_dump(ini_get("session.cookie_lifetime"));
|
|
|
|
var_dump(ini_get("session.cookie_lifetime"));
|
|
var_dump(session_set_cookie_params(["lifetime" => -10]));
|
|
var_dump(ini_get("session.cookie_lifetime"));
|
|
echo "Done";
|
|
ob_end_flush();
|
|
?>
|
|
--EXPECTF--
|
|
string(1) "0"
|
|
bool(true)
|
|
string(1) "0"
|
|
string(1) "0"
|
|
|
|
Warning: session_set_cookie_params(): session.cookie_lifetime must be between 0 and %d in %s on line %d
|
|
bool(false)
|
|
string(1) "0"
|
|
Done
|