1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Files
archived-php-src/ext/session/tests/bug69111.phpt
T
Yasuo Ohgaki bfb9307b2d Fixed bug #69111 (Crash in SessionHandler::read()).
Made session save handler abuse much harder than before.
2016-01-15 15:50:14 +09:00

36 lines
996 B
PHP

--TEST--
Bug #69111 (Crash in SessionHandler::read())
--INI--
session.save_path=
session.save_handler=files
session.name=PHPSESSID
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
$sh = new SessionHandler;
session_set_save_handler($sh);
$savePath = ini_get('session.save_path');
$sessionName = ini_get('session.name');
// session_start(); // Uncommenting this makes it not crash when reading the session (see below), but it will not return any data.
$sh->open($savePath, $sessionName);
$sh->write("foo", "bar");
$sh->read($id);
$sh->gc(1245);
$sh->close();
?>
--EXPECTF--
Warning: SessionHandler::open(): Session is not active in %s on line 10
Warning: SessionHandler::write(): Session is not active in %s on line 11
Notice: Undefined variable: id in %s on line 12
Warning: SessionHandler::read(): Session is not active in %s on line 12
Warning: SessionHandler::gc(): Session is not active in %s on line 13
Warning: SessionHandler::close(): Session is not active in %s on line 14