File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / session / tests / bug32330.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>