1--TEST-- 2Object test, unserialize_callback_func 3--SKIPIF-- 4--INI-- 5unserialize_callback_func=autoload 6--FILE-- 7<?php 8if(!extension_loaded('msgpack')) { 9 dl('msgpack.' . PHP_SHLIB_SUFFIX); 10} 11 12function test($type, $variable, $test) { 13 $serialized = pack('H*', $variable); 14 $unserialized = msgpack_unserialize($serialized); 15 16 echo $type, PHP_EOL; 17 echo bin2hex($serialized), PHP_EOL; 18 var_dump($unserialized); 19 echo $test || $unserialized->b == 2 ? 'OK' : 'ERROR', PHP_EOL; 20} 21 22function autoload($classname) { 23 class Obj { 24 var $a; 25 var $b; 26 27 function __construct($a, $b) { 28 $this->a = $a; 29 $this->b = $b; 30 } 31 } 32} 33 34test('autoload', '83c0a34f626aa16101a16202', false); 35?> 36--EXPECTF-- 37autoload 3883c0a34f626aa16101a16202 39object(Obj)#%d (2) { 40 ["a"]=> 41 int(1) 42 ["b"]=> 43 int(2) 44} 45OK 46