xref: /PHP-8.2/ext/session/tests/bug69111.phpt (revision b5a14e6c)
1--TEST--
2Bug #69111 Crash in SessionHandler::read()
3--EXTENSIONS--
4session
5--SKIPIF--
6<?php include('skipif.inc'); ?>
7--FILE--
8<?php
9$sh = new SessionHandler;
10session_set_save_handler($sh);
11
12$savePath = ini_get('session.save_path');
13$sessionName = ini_get('session.name');
14
15// session_start(); // Uncommenting this makes it not crash when reading the session (see below), but it will not return any data.
16
17try {
18    $sh->open($savePath, $sessionName);
19} catch (Error $exception) {
20    echo $exception->getMessage() . "\n";
21}
22
23try {
24    $sh->write("foo", "bar");
25} catch (Error $exception) {
26    echo $exception->getMessage() . "\n";
27}
28
29try {
30    $sh->read("");
31} catch (Error $exception) {
32    echo $exception->getMessage() . "\n";
33}
34
35?>
36--EXPECT--
37Session is not active
38Session is not active
39Session is not active
40