New PHP5 APC - version 3.0.19, using PHP5 5.2.0-8+etch11,
[php5-apc.git] / tests / apc_003.phpt
1 --TEST--
2 APC: apc_store/fetch with objects
3 --SKIPIF--
4 <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5 --INI--
6 apc.enabled=1
7 apc.enable_cli=1
8 apc.file_update_protection=0
9 --FILE--
10 <?php
11
12 class foo { }
13 $foo = new foo;
14 print_r($foo);
15 apc_store('foo',$foo);
16 unset($foo);
17 $bar = apc_fetch('foo');
18 print_r($bar);
19 $bar->a = true;
20 print_r($bar);
21
22 class bar extends foo
23 {
24         public    $pub = 'bar';
25         protected $pro = 'bar';
26         private   $pri = 'bar'; // we don't see this, we'd need php 5.1 new serialization
27         
28         function __construct()
29         {
30                 $this->bar = true;
31         }
32         
33         function change()
34         {
35                 $this->pri = 'mod';
36         }
37 }
38
39 class baz extends bar
40 {
41         private $pri = 'baz';
42
43         function __construct()
44         {
45                 parent::__construct();
46                 $this->baz = true;
47         }
48 }
49
50 $baz = new baz;
51 print_r($baz);
52 $baz->change();
53 print_r($baz);
54 apc_store('baz', $baz);
55 unset($baz);
56 print_r(apc_fetch('baz'));
57
58 ?>
59 ===DONE===
60 <?php exit(0); ?>
61 --EXPECTF--
62 foo Object
63 (
64 )
65 foo Object
66 (
67 )
68 foo Object
69 (
70     [a] => 1
71 )
72 baz Object
73 (
74     [pri%sprivate] => baz
75     [pub] => bar
76     [pro:protected] => bar
77     [pri%sprivate] => bar
78     [bar] => 1
79     [baz] => 1
80 )
81 baz Object
82 (
83     [pri%sprivate] => baz
84     [pub] => bar
85     [pro:protected] => bar
86     [pri%sprivate] => mod
87     [bar] => 1
88     [baz] => 1
89 )
90 baz Object
91 (
92     [pri%sprivate] => baz
93     [pub] => bar
94     [pro:protected] => bar
95     [pri%sprivate] => mod
96     [bar] => 1
97     [baz] => 1
98 )
99 ===DONE===