1--TEST-- 2Test session_set_save_handler() function: GC variation 3--EXTENSIONS-- 4session 5--INI-- 6session.gc_probability=1 7session.gc_divisor=1 8session.gc_maxlifetime=0 9session.save_path= 10session.name=PHPSESSID 11--FILE-- 12<?php 13 14ob_start(); 15 16echo "*** Testing session_set_save_handler() : variation ***\n"; 17 18function noisy_gc($maxlifetime) { 19 echo("GC [".$maxlifetime."]\n"); 20 echo gc($maxlifetime)." deleted\n"; 21 return true; 22} 23 24require_once "save_handler.inc"; 25$path = __DIR__ . '/session_set_save_handler_variation4'; 26@mkdir($path); 27session_save_path($path); 28session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc"); 29 30session_start(); 31$_SESSION["Blah"] = "Hello World!"; 32$_SESSION["Foo"] = FALSE; 33$_SESSION["Guff"] = 1234567890; 34var_dump($_SESSION); 35$session_id = session_id(); 36var_dump(session_write_close()); 37 38session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc"); 39session_id($session_id); 40session_start(); 41var_dump($_SESSION); 42var_dump(session_destroy()); 43 44ob_end_flush(); 45?> 46--CLEAN-- 47<?php 48$path = __DIR__ . '/session_set_save_handler_variation4'; 49rmdir($path); 50?> 51--EXPECTF-- 52*** Testing session_set_save_handler() : variation *** 53 54Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d 55Open [%s,PHPSESSID] 56Read [%s,%s] 57GC [0] 581 deleted 59array(3) { 60 ["Blah"]=> 61 string(12) "Hello World!" 62 ["Foo"]=> 63 bool(false) 64 ["Guff"]=> 65 int(1234567890) 66} 67Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;] 68Close [%s,PHPSESSID] 69bool(true) 70 71Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d 72Open [%s,PHPSESSID] 73Read [%s,%s] 74GC [0] 751 deleted 76array(3) { 77 ["Blah"]=> 78 string(12) "Hello World!" 79 ["Foo"]=> 80 bool(false) 81 ["Guff"]=> 82 int(1234567890) 83} 84Destroy [%s,%s] 85 86Warning: unlink(%s): No such file or directory in %s on line %d 87Close [%s,PHPSESSID] 88bool(true) 89