1--TEST-- 2Check for serialization handler, ini-directive 3--SKIPIF-- 4<?php 5if (version_compare(PHP_VERSION, '5.2.0') < 0) { 6 echo "skip tests in PHP 5.2 or newer"; 7} 8if (!extension_loaded("session")) { 9 echo "skip needs session enabled"; 10} 11--INI-- 12session.serialize_handler=msgpack 13--FILE-- 14<?php 15if(!extension_loaded('msgpack')) { 16 dl('msgpack.' . PHP_SHLIB_SUFFIX); 17} 18 19$output = ''; 20 21function open($path, $name) { 22 return true; 23} 24 25function close() { 26 return true; 27} 28 29function read($id) { 30 global $output; 31 return pack('H*', '81a3666f6f01'); 32} 33 34function write($id, $data) { 35 global $output; 36 $output .= bin2hex($data) . PHP_EOL; 37 return true; 38} 39 40function destroy($id) { 41 return true; 42} 43 44function gc($time) { 45 return true; 46} 47 48session_set_save_handler('open', 'close', 'read', 'write', 'destroy', 'gc'); 49 50session_start(); 51 52echo ++$_SESSION['foo'], PHP_EOL; 53 54session_write_close(); 55 56echo $output; 57var_dump($_SESSION); 58?> 59--EXPECT-- 602 6182c001a3666f6f02 62array(1) { 63 ["foo"]=> 64 int(2) 65} 66