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