summaryrefslogtreecommitdiff
path: root/ext/standard/tests/serialize/bug49649.phpt
blob: 2e0a5059301196ba9f95d8fb30d760b660e2489d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--TEST--
Bug #49649 (unserialize() doesn't handle changes in property visibility) - to public
--FILE--
<?php

/**
 *class Foo
 *{
 *	private $private = 1;
 *	
 *	protected $protected = 2;
 *	
 *	public $public = 3;
 *	
 *	public $notThere = 'old';
 * }
 *
 * echo base64_encode(serialize(new Foo()));
 *
 * The class above represents the serialized, base64_encoded string below.
*/
$serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb3RlY3RlZCI7aToyO3M6NjoicHVibGljIjtpOjM7czo4OiJub3RUaGVyZSI7czozOiJvbGQiO30';

class Foo
{
	public $public = null;

	public $protected = null;

	public $private = null;
}

$class = unserialize(base64_decode($serialized));
var_dump($class);
--EXPECT--
object(Foo)#1 (4) {
  ["public"]=>
  int(3)
  ["protected"]=>
  int(2)
  ["private"]=>
  int(1)
  ["notThere"]=>
  string(3) "old"
}