1--TEST--
2Test session.gc_probability and session.gc_divisor settings for invalid values
3--INI--
4session.gc_maxlifetime=1
5--EXTENSIONS--
6session
7--SKIPIF--
8<?php
9include('skipif.inc');
10?>
11--FILE--
12<?php
13
14$gc_settings = [
15    [
16        'gc_probability' => -1,
17        'gc_divisor' => -1
18    ],
19    [
20        'gc_probability' => -1,
21        'gc_divisor' => 1
22    ],
23    [
24        'gc_probability' => 1,
25        'gc_divisor' => -1
26    ],
27    [
28        'gc_probability' => 1,
29        'gc_divisor' => 0
30    ],
31];
32
33ob_start();
34foreach($gc_settings as $gc_setting) {
35try {
36    session_start($gc_setting);
37    session_write_close();
38    } catch (Throwable $e) {
39        echo $e::class, ': '. $e->getMessage(), "\n";
40    }
41}
42ob_end_flush();
43?>
44Done
45--EXPECTF--
46Warning: session_start(): session.gc_probability must be greater than or equal to 0 in %s on line %d
47
48Warning: session_start(): Setting option "gc_probability" failed in %s on line %d
49
50Warning: session_start(): session.gc_divisor must be greater than 0 in %s on line %d
51
52Warning: session_start(): Setting option "gc_divisor" failed in %s on line %d
53
54Warning: session_start(): session.gc_probability must be greater than or equal to 0 in %s on line %d
55
56Warning: session_start(): Setting option "gc_probability" failed in %s on line %d
57
58Warning: session_start(): session.gc_divisor must be greater than 0 in %s on line %d
59
60Warning: session_start(): Setting option "gc_divisor" failed in %s on line %d
61
62Warning: session_start(): session.gc_divisor must be greater than 0 in %s on line %d
63
64Warning: session_start(): Setting option "gc_divisor" failed in %s on line %d
65Done
66