1--TEST-- 2GMP serialization and unserialization 3--SKIPIF-- 4<?php if (!extension_loaded("gmp")) print "skip"; ?> 5--FILE-- 6<?php 7 8var_dump($n = gmp_init(42)); 9var_dump($s = serialize($n)); 10var_dump(unserialize($s)); 11 12$n = gmp_init(13); 13$n->foo = "bar"; 14var_dump(unserialize(serialize($n))); 15 16try { 17 unserialize('C:3:"GMP":0:{}'); 18} catch (Exception $e) { var_dump($e->getMessage()); } 19 20try { 21 unserialize('C:3:"GMP":9:{s:2:"42";}'); 22} catch (Exception $e) { var_dump($e->getMessage()); } 23 24?> 25--EXPECTF-- 26object(GMP)#%d (1) { 27 ["num"]=> 28 string(2) "42" 29} 30string(30) "C:3:"GMP":15:{s:2:"42";a:0:{}}" 31object(GMP)#%d (1) { 32 ["num"]=> 33 string(2) "42" 34} 35object(GMP)#%d (2) { 36 ["foo"]=> 37 string(3) "bar" 38 ["num"]=> 39 string(2) "13" 40} 41string(28) "Could not unserialize number" 42string(32) "Could not unserialize properties" 43