Fix issue with calling a unique, non-persistent method
[hiphop-php.git] / hphp / test / slow / hhbbc / private_props_003.php
blobb3926f4ff1797ae08d25688f32fc54854f255193
1 <?hh
3 /*
4 * Unserialization does not check values, so property types do not
5 * infer specific values.
7 * Test this by making sure that we don't constant propagate from
8 * values in object properties.
9 */
11 class SerDe {
12 private $x = 42;
13 private $y = 3.14;
14 private $z = false;
15 public function foo() {
16 $xx = $this->x + 1;
17 $yy = $this->y + 1.0;
18 $zz = !$this->z;
19 var_dump($xx, $yy, $zz);
23 function main() {
24 $x = new SerDe;
25 $str = serialize($x);
26 $str = preg_replace('/i:42/', 'i:0', $str);
27 $str = preg_replace('/d:3.14/', 'd:1.0', $str);
28 $str = preg_replace('/b:0/', 'b:1', $str);
29 $x = unserialize($str);
30 $x->foo();
33 main();