File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -1738,7 +1738,7 @@ PHP_METHOD(BcMath_Number, __unserialize)
1738
1738
ZEND_PARSE_PARAMETERS_END ();
1739
1739
1740
1740
zval * zv = zend_hash_str_find (props , "value" , sizeof ("value" )- 1 );
1741
- if (!zv || Z_TYPE_P (zv ) != IS_STRING ) {
1741
+ if (!zv || Z_TYPE_P (zv ) != IS_STRING || Z_STRLEN_P ( zv ) == 0 ) {
1742
1742
goto fail ;
1743
1743
}
1744
1744
Original file line number Diff line number Diff line change @@ -11,12 +11,26 @@ try {
11
11
echo $ e ->getMessage () . "\n" ;
12
12
}
13
13
14
- try {
15
- unserialize ('O:13:"BcMath\Number":1:{s:5:"value";s:1:"a";} ' );
16
- } catch (Exception $ e ) {
17
- echo $ e ->getMessage ();
14
+ echo "\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
+
22
+ foreach ($ cases as $ case ) {
23
+ try {
24
+ unserialize ($ case );
25
+ } catch (Exception $ e ) {
26
+ echo $ e ->getMessage () . "\n" ;
27
+ }
18
28
}
19
29
?>
20
30
--EXPECT--
21
31
Cannot modify readonly property BcMath\Number::$value
32
+
33
+ Invalid serialization data for BcMath\Number object
34
+ Invalid serialization data for BcMath\Number object
35
+ Invalid serialization data for BcMath\Number object
22
36
Invalid serialization data for BcMath\Number object
You can’t perform that action at this time.
0 commit comments