File: apcu.phpt

package info (click to toggle)
php-msgpack 1%3A3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,224 kB
  • sloc: ansic: 3,925; xml: 458; makefile: 2
file content (63 lines) | stat: -rw-r--r-- 1,007 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--TEST--
APCu serialization
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=msgpack
--SKIPIF--
<?php
if (!extension_loaded("msgpack")) print "skip";
if (!extension_loaded("apcu")) {
   echo "skip needs APCu enabled";
}
?>
--FILE--
<?php
echo ini_get('apc.serializer'), "\n";

apcu_store('foo', 100);
var_dump(apcu_fetch('foo'));

$foo = 'hello world';

apcu_store('foo', $foo);
var_dump(apcu_fetch('foo'));

apcu_store('foo\x00bar', $foo);
var_dump(apcu_fetch('foo\x00bar'));

apcu_store('foo', ['foo' => $foo]);
var_dump(apcu_fetch('foo'));

class Foo {
    public $int = 10;
    protected $array = [];
    private $string = 'foo';
}

$a = new Foo;
apcu_store('foo', $a);
unset($a);
var_dump(apcu_fetch('foo'));

?>
===DONE===
--EXPECT--
msgpack
int(100)
string(11) "hello world"
string(11) "hello world"
array(1) {
  ["foo"]=>
  string(11) "hello world"
}
object(Foo)#1 (3) {
  ["int"]=>
  int(10)
  ["array":protected]=>
  array(0) {
  }
  ["string":"Foo":private]=>
  string(3) "foo"
}
===DONE===