1--TEST-- 2Bug #32330 (session_destroy, "Failed to initialize storage module", custom session handler) 3--SKIPIF-- 4<?php include('skipif.inc'); ?> 5--INI-- 6session.use_trans_sid=0 7session.use_cookies=1 8session.name=sid 9session.save_path=/tmp 10session.gc_probability=1 11session.gc_divisor=1 12session.save_handler=files 13--FILE-- 14<?php 15error_reporting(E_ALL); 16 17function sOpen($path, $name) 18{ 19 echo "open: path = {$path}, name = {$name}\n"; 20 return TRUE; 21} 22 23function sClose() 24{ 25 echo "close\n"; 26 return TRUE; 27} 28 29function sRead($id) 30{ 31 echo "read: id = {$id}\n"; 32 return ''; 33} 34 35function sWrite($id, $data) 36{ 37 echo "write: id = {$id}, data = {$data}\n"; 38 return TRUE; 39} 40 41function sDestroy($id) 42{ 43 echo "destroy: id = {$id}\n"; 44 return TRUE; 45} 46 47function sGC($maxlifetime) 48{ 49 echo "gc: maxlifetime = {$maxlifetime}\n"; 50 return TRUE; 51} 52 53session_set_save_handler( 'sOpen', 'sClose', 'sRead', 'sWrite', 'sDestroy', 'sGC' ); 54 55// without output buffering, the debug messages will cause all manner of warnings 56ob_start(); 57 58session_start(); 59$_SESSION['A'] = 'B'; 60session_write_close(); 61 62session_start(); 63$_SESSION['C'] = 'D'; 64session_destroy(); 65 66session_start(); 67$_SESSION['E'] = 'F'; 68// Don't try to destroy this time! 69 70?> 71--EXPECTF-- 72open: path = /tmp, name = sid 73read: id = %s 74gc: maxlifetime = %d 75write: id = %s, data = A|s:1:"B"; 76close 77open: path = /tmp, name = sid 78read: id = %s 79gc: maxlifetime = %d 80destroy: id = %s 81close 82open: path = /tmp, name = sid 83read: id = %s 84gc: maxlifetime = %d 85write: id = %s, data = E|s:1:"F"; 86close 87