~ubuntu-branches/ubuntu/vivid/php-apcu/vivid

« back to all changes in this revision

Viewing changes to apcu-4.0.4/tests/apc_003b.phpt

  • Committer: Package Import Robot
  • Author(s): Ondřej Surý
  • Date: 2014-06-24 10:52:52 UTC
  • mfrom: (7.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20140624105252-vsqs1r4og4ykucqg
Tags: 4.0.6-1
* New upstream version 4.0.6
* Remove PHP 5.6 support patch - merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--TEST--
2
 
APC: apc_store/fetch with objects (php 5.3)
3
 
--SKIPIF--
4
 
<?php
5
 
    require_once(dirname(__FILE__) . '/skipif.inc'); 
6
 
    if(version_compare(zend_version(), '2.3.0') < 0) {
7
 
                echo "skip\n";
8
 
        }
9
 
?>
10
 
--INI--
11
 
apc.enabled=1
12
 
apc.enable_cli=1
13
 
apc.file_update_protection=0
14
 
--FILE--
15
 
<?php
16
 
 
17
 
class foo { }
18
 
$foo = new foo;
19
 
var_dump($foo);
20
 
apc_store('foo',$foo);
21
 
unset($foo);
22
 
$bar = apc_fetch('foo');
23
 
var_dump($bar);
24
 
$bar->a = true;
25
 
var_dump($bar);
26
 
 
27
 
class bar extends foo
28
 
{
29
 
        public    $pub = 'bar';
30
 
        protected $pro = 'bar';
31
 
        private   $pri = 'bar'; // we don't see this, we'd need php 5.1 new serialization
32
 
        
33
 
        function __construct()
34
 
        {
35
 
                $this->bar = true;
36
 
        }
37
 
        
38
 
        function change()
39
 
        {
40
 
                $this->pri = 'mod';
41
 
        }
42
 
}
43
 
 
44
 
class baz extends bar
45
 
{
46
 
        private $pri = 'baz';
47
 
 
48
 
        function __construct()
49
 
        {
50
 
                parent::__construct();
51
 
                $this->baz = true;
52
 
        }
53
 
}
54
 
 
55
 
$baz = new baz;
56
 
var_dump($baz);
57
 
$baz->change();
58
 
var_dump($baz);
59
 
apc_store('baz', $baz);
60
 
unset($baz);
61
 
var_dump(apc_fetch('baz'));
62
 
 
63
 
?>
64
 
===DONE===
65
 
<?php exit(0); ?>
66
 
--EXPECTF--
67
 
object(foo)#%d (0) {
68
 
}
69
 
object(foo)#%d (0) {
70
 
}
71
 
object(foo)#%d (1) {
72
 
  ["a"]=>
73
 
  bool(true)
74
 
}
75
 
object(baz)#%d (6) {
76
 
  ["pri":"baz":private]=>
77
 
  string(3) "baz"
78
 
  ["pub"]=>
79
 
  string(3) "bar"
80
 
  ["pro":protected]=>
81
 
  string(3) "bar"
82
 
  ["pri":"bar":private]=>
83
 
  string(3) "bar"
84
 
  ["bar"]=>
85
 
  bool(true)
86
 
  ["baz"]=>
87
 
  bool(true)
88
 
}
89
 
object(baz)#%d (6) {
90
 
  ["pri":"baz":private]=>
91
 
  string(3) "baz"
92
 
  ["pub"]=>
93
 
  string(3) "bar"
94
 
  ["pro":protected]=>
95
 
  string(3) "bar"
96
 
  ["pri":"bar":private]=>
97
 
  string(3) "mod"
98
 
  ["bar"]=>
99
 
  bool(true)
100
 
  ["baz"]=>
101
 
  bool(true)
102
 
}
103
 
object(baz)#%d (6) {
104
 
  ["pri":"baz":private]=>
105
 
  string(3) "baz"
106
 
  ["pub"]=>
107
 
  string(3) "bar"
108
 
  ["pro":protected]=>
109
 
  string(3) "bar"
110
 
  ["pri":"bar":private]=>
111
 
  string(3) "mod"
112
 
  ["bar"]=>
113
 
  bool(true)
114
 
  ["baz"]=>
115
 
  bool(true)
116
 
}
117
 
===DONE===