1--TEST-- 2Check for integer serialisation 3--SKIPIF-- 4--FILE-- 5<?php 6if(!extension_loaded('msgpack')) { 7 dl('msgpack.' . PHP_SHLIB_SUFFIX); 8} 9 10function test($type, $variable) { 11 $serialized = msgpack_serialize($variable); 12 $unserialized = msgpack_unserialize($serialized); 13 14 echo $type, PHP_EOL; 15 echo bin2hex($serialized), PHP_EOL; 16 var_dump($unserialized); 17 echo $unserialized === $variable ? 'OK' : 'ERROR', PHP_EOL; 18} 19 20test('zero: 0', 0); 21test('small: 1', 1); 22test('small: -1', -1); 23test('medium: 1000', 1000); 24test('medium: -1000', -1000); 25test('large: 100000', 100000); 26test('large: -100000', -100000); 27?> 28--EXPECT-- 29zero: 0 3000 31int(0) 32OK 33small: 1 3401 35int(1) 36OK 37small: -1 38ff 39int(-1) 40OK 41medium: 1000 42cd03e8 43int(1000) 44OK 45medium: -1000 46d1fc18 47int(-1000) 48OK 49large: 100000 50ce000186a0 51int(100000) 52OK 53large: -100000 54d2fffe7960 55int(-100000) 56OK 57