1--TEST-- 2BcMath\Number unserialize error 3--EXTENSIONS-- 4bcmath 5--FILE-- 6<?php 7try { 8 $num = new BcMath\Number(1); 9 $num->__unserialize(['value' => '5']); 10} catch (Error $e) { 11 echo $e->getMessage() . "\n"; 12} 13 14echo "\n"; 15$cases = [ 16 'O:13:"BcMath\Number":1:{s:5:"value";s:1:"a";}', 17 'O:13:"BcMath\Number":1:{s:5:"value";s:0:"";}', 18 'O:13:"BcMath\Number":0:{}', 19 'O:13:"BcMath\Number":1:{s:5:"value";i:1;}', 20]; 21 22foreach ($cases as $case) { 23 try { 24 unserialize($case); 25 } catch (Exception $e) { 26 echo $e->getMessage() . "\n"; 27 } 28} 29?> 30--EXPECT-- 31Cannot modify readonly property BcMath\Number::$value 32 33Invalid serialization data for BcMath\Number object 34Invalid serialization data for BcMath\Number object 35Invalid serialization data for BcMath\Number object 36Invalid serialization data for BcMath\Number object 37