1--TEST--
2__wakeup should be able to modify dynamic properties without affecting copies of those properties
3--SKIPIF--
4<?php if (!extension_loaded("json")) print "skip json_encode needed"; ?>
5--FILE--
6<?php
7
8class Obj {
9	// Testing $this->a being a dynamic property.
10
11	function __construct($a) {
12		$this->a = $a;
13	}
14
15	public function __wakeup() {
16		echo "Calling __wakeup " . json_encode($this->a) . "\n";
17		$this->a = "roh";
18	}
19}
20
21function main() {
22	$obj = new stdClass();
23	$obj->c = null;
24    $variable = [new Obj($obj), new Obj($obj), $obj];
25	$serialized = serialize($variable);
26	printf("%s\n", $serialized);
27	$unserialized = unserialize($serialized);
28	var_dump($unserialized);
29}
30main();
31--EXPECTF--
32a:3:{i:0;O:3:"Obj":1:{s:1:"a";O:8:"stdClass":1:{s:1:"c";N;}}i:1;O:3:"Obj":1:{s:1:"a";r:3;}i:2;r:3;}
33Calling __wakeup {"c":null}
34Calling __wakeup {"c":null}
35array(3) {
36  [0]=>
37  object(Obj)#%d (1) {
38    ["a"]=>
39    string(3) "roh"
40  }
41  [1]=>
42  object(Obj)#%d (1) {
43    ["a"]=>
44    string(3) "roh"
45  }
46  [2]=>
47  object(stdClass)#%d (1) {
48    ["c"]=>
49    NULL
50  }
51}
52