xref: /PHP-7.2/ext/standard/tests/math/bug27646.phpt (revision 610c7fbe)
1--TEST--
2Bug #27646 (Cannot serialize/unserialize non-finite numeric values)
3--FILE--
4<?php
5set_time_limit(5);
6
7$f=12.3;
8var_dump($f);
9var_dump(serialize($f));
10var_dump(unserialize(serialize($f)));
11
12$f=-12.3;
13var_dump($f);
14var_dump(serialize($f));
15var_dump(unserialize(serialize($f)));
16
17$f=-INF;
18var_dump($f);
19var_dump(serialize($f));
20var_dump(unserialize(serialize($f)));
21
22$f=INF;
23var_dump($f);
24var_dump(serialize($f));
25var_dump(unserialize(serialize($f)));
26
27$f=NAN;
28var_dump($f);
29var_dump(serialize($f));
30var_dump(unserialize(serialize($f)));
31
32?>
33--EXPECTF--
34float(1%f)
35string(%d) "d:1%s;"
36float(1%f)
37float(-1%f)
38string(%d) "d:-1%s;"
39float(-1%f)
40float(-INF)
41string(7) "d:-INF;"
42float(-INF)
43float(INF)
44string(6) "d:INF;"
45float(INF)
46float(NAN)
47string(6) "d:NAN;"
48float(NAN)
49