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