1--TEST--
2Test session_start() with flag read_and_close
3--EXTENSIONS--
4session
5--SKIPIF--
6<?php include('skipif.inc'); ?>
7--FILE--
8<?php
9
10ob_start();
11
12$valuesEnablingReadAndClose = [true, 1, "1", "777", 777, -1];
13
14$valuesDisablingReadAndClose = ["true", false, "false", 0, "0", "no", "00000"];
15
16foreach ($valuesEnablingReadAndClose as $value) {
17    session_start(["read_and_close" => $value]);
18    var_dump(session_status() === PHP_SESSION_NONE);
19}
20
21foreach ($valuesDisablingReadAndClose as $value) {
22    session_start(["read_and_close" => $value]);
23    var_dump(session_status() === PHP_SESSION_ACTIVE);
24    session_write_close();
25}
26
27try {
28    session_start(["read_and_close" => 1.0]);
29} catch (Throwable $e) {
30    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
31}
32
33ob_end_flush();
34?>
35--EXPECTF--
36bool(true)
37bool(true)
38bool(true)
39bool(true)
40bool(true)
41bool(true)
42bool(true)
43bool(true)
44bool(true)
45bool(true)
46bool(true)
47bool(true)
48bool(true)
49TypeError: session_start(): Option "read_and_close" must be of type string|int|bool, float given
50