1--TEST-- 2Test session_set_save_handler() function : test lazy_write 3--INI-- 4session.use_strict_mode=0 5session.lazy_write=1 6session.save_path= 7session.name=PHPSESSID 8session.gc_probability=0 9session.save_handler=files 10--EXTENSIONS-- 11session 12--SKIPIF-- 13<?php include('skipif.inc'); ?> 14--FILE-- 15<?php 16 17ob_start(); 18 19echo "*** Testing session_set_save_handler() : test write short circuit ***\n"; 20 21require_once "save_handler.inc"; 22$path = __DIR__ . '/session_set_save_handler_variation6'; 23@mkdir($path); 24session_save_path($path); 25session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update"); 26 27session_start(); 28$session_id = session_id(); 29$_SESSION["Blah"] = "Hello World!"; 30$_SESSION["Foo"] = FALSE; 31$_SESSION["Guff"] = 1234567890; 32var_dump($_SESSION); 33 34session_write_close(); 35session_unset(); 36var_dump($_SESSION); 37 38echo "Starting session again..!\n"; 39session_id($session_id); 40session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update"); 41session_start(); 42var_dump($_SESSION); 43$_SESSION['Bar'] = 'Foo'; 44session_write_close(); 45 46echo "Starting session again..!\n"; 47session_id($session_id); 48session_set_save_handler("open", "close", "read", "write", "destroy", "gc", "create_sid", "validate_sid", "update"); 49session_start(); 50var_dump($_SESSION); 51// $_SESSION should be the same and should skip write() 52session_write_close(); 53 54echo "Cleanup\n"; 55session_start(); 56session_destroy(); 57 58ob_end_flush(); 59rmdir($path); 60?> 61--EXPECTF-- 62*** Testing session_set_save_handler() : test write short circuit *** 63Open [%s,PHPSESSID] 64CreateID [PHPT-%s] 65Read [%s,%s] 66array(3) { 67 ["Blah"]=> 68 string(12) "Hello World!" 69 ["Foo"]=> 70 bool(false) 71 ["Guff"]=> 72 int(1234567890) 73} 74Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;] 75Close [%s,PHPSESSID] 76array(3) { 77 ["Blah"]=> 78 string(12) "Hello World!" 79 ["Foo"]=> 80 bool(false) 81 ["Guff"]=> 82 int(1234567890) 83} 84Starting session again..! 85Open [%s,PHPSESSID] 86Read [%s,%s] 87array(3) { 88 ["Blah"]=> 89 string(12) "Hello World!" 90 ["Foo"]=> 91 bool(false) 92 ["Guff"]=> 93 int(1234567890) 94} 95Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;Bar|s:3:"Foo";] 96Close [%s,PHPSESSID] 97Starting session again..! 98Open [%s,PHPSESSID] 99Read [%s,%s] 100array(4) { 101 ["Blah"]=> 102 string(12) "Hello World!" 103 ["Foo"]=> 104 bool(false) 105 ["Guff"]=> 106 int(1234567890) 107 ["Bar"]=> 108 string(3) "Foo" 109} 110Update [%s,PHPT-%d] 111Close [%s,PHPSESSID] 112Cleanup 113Open [%s,PHPSESSID] 114Read [%s,PHPT-%d] 115Destroy [%s,PHPT-%d] 116Close [%s,PHPSESSID] 117