/home/lnzliplg/public_html/alt-php80-pecl-apcu_5.1.23-1.el8.zip
PK �c�\����{ { tests/apc_005.phptnu �[��� --TEST--
APC: apcu_store/fetch with arrays of objects
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$foo = array(new stdclass(), new stdclass());
var_dump($foo);
apcu_store('foo',$foo);
$bar = apcu_fetch('foo');
var_dump($foo);
var_dump($bar);
?>
===DONE===
--EXPECT--
array(2) {
[0]=>
object(stdClass)#1 (0) {
}
[1]=>
object(stdClass)#2 (0) {
}
}
array(2) {
[0]=>
object(stdClass)#1 (0) {
}
[1]=>
object(stdClass)#2 (0) {
}
}
array(2) {
[0]=>
object(stdClass)#3 (0) {
}
[1]=>
object(stdClass)#4 (0) {
}
}
===DONE===
PK �c�\U��i tests/apc_006_php81.phptnu �[��� --TEST--
APC: apcu_store/fetch reference test
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
if (PHP_VERSION_ID < 80100) die('skip Only for PHP >= 8.1');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=php
report_memleaks=0
--FILE--
<?php
$a = 'a';
$b = array($a);
$c = array('c');
$b[] = &$c;
$b[] = &$c;
$d = 'd';
$b[] = &$d;
$b[] = &$d;
$b[] = &$d;
$e = 'e';
$b[] = $e;
$b[] = $e;
$f = array('f');
$f[] = &$f;
$b[] = &$f;
apcu_store('test', $b);
$x = apcu_fetch('test');
debug_zval_dump($x);
?>
===DONE===
--EXPECTF--
array(9) refcount(2){
[0]=>
string(1) "a" interned
[1]=>
reference refcount(2) {
array(1) refcount(1){
[0]=>
string(1) "c" interned
}
}
[2]=>
reference refcount(2) {
array(1) refcount(1){
[0]=>
string(1) "c" interned
}
}
[3]=>
reference refcount(3) {
string(1) "d" interned
}
[4]=>
reference refcount(3) {
string(1) "d" interned
}
[5]=>
reference refcount(3) {
string(1) "d" interned
}
[6]=>
string(1) "e" interned
[7]=>
string(1) "e" interned
[8]=>
reference refcount(2) {
array(2) refcount(1){
[0]=>
string(1) "f" interned
[1]=>
reference refcount(2) {
*RECURSION*
}
}
}
}
===DONE===
PK �c�\��~9 tests/iterator_008.phptnu �[��� --TEST--
APC: APCIterator array
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$it = new APCuIterator(['key1', 'key7', 'key9']);
for($i = 0; $i < 10; $i++) {
apcu_store("key$i", "value$i");
}
foreach($it as $key=>$value) {
$vals[$key] = $value['key'];
}
ksort($vals);
var_dump($vals);
?>
===DONE===
--EXPECT--
array(3) {
["key1"]=>
string(4) "key1"
["key7"]=>
string(4) "key7"
["key9"]=>
string(4) "key9"
}
===DONE===
PK �c�\ڨ{-~ ~ # tests/apc_store_array_int_keys.phptnu �[��� --TEST--
apcu_store() with int keys in array should convert them to string
--SKIPIF--
<?php
require_once(__DIR__ . '/skipif.inc');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
var_dump(apcu_add(["123" => "test"]));
var_dump(apcu_store(["123" => "test"]));
var_dump(apcu_add(["123" => "test"]));
?>
--EXPECT--
array(0) {
}
array(0) {
}
array(1) {
[123]=>
int(-1)
}
PK �c�\9 \� � tests/apc_099.phptnu �[��� --TEST--
APCU: apcu_fetch segfault
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_store('a', 'value');
var_export(apcu_delete(['a', 'b', 'c', 0]));
--EXPECTF--
Warning: apcu_delete(): apc_delete() expects a string, array of strings, or APCIterator instance in %s on line 4
array (
0 => 'b',
1 => 'c',
2 => 0,
)
PK �c�\���/w w tests/iterator_007.phptnu �[��� --TEST--
APC: APCIterator Overwriting the ctor
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
class foobar extends APCuIterator {
public function __construct() {}
}
$obj = new foobar;
try {
$obj->rewind();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$obj->current();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$obj->key();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$obj->next();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$obj->valid();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$obj->getTotalHits();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$obj->getTotalSize();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$obj->getTotalCount();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
apcu_delete($obj);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Trying to use uninitialized APCUIterator
Trying to use uninitialized APCUIterator
Trying to use uninitialized APCUIterator
Trying to use uninitialized APCUIterator
Trying to use uninitialized APCUIterator
Trying to use uninitialized APCUIterator
Trying to use uninitialized APCUIterator
Trying to use uninitialized APCUIterator
Trying to use uninitialized APCUIterator
PK �c�\zP�� � tests/apc_006.phptnu �[��� --TEST--
APC: apcu_store/fetch reference test
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
if (PHP_VERSION_ID >= 70300) die('skip Only for PHP < 7.3');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=php
report_memleaks=0
--FILE--
<?php
$a = 'a';
$b = array($a);
$c = array('c');
$b[] = &$c;
$b[] = &$c;
$d = 'd';
$b[] = &$d;
$b[] = &$d;
$b[] = &$d;
$e = 'e';
$b[] = $e;
$b[] = $e;
$f = array('f');
$f[] = &$f;
$b[] = &$f;
apcu_store('test', $b);
$x = apcu_fetch('test');
debug_zval_dump($x);
?>
===DONE===
--EXPECT--
array(9) refcount(2){
[0]=>
string(1) "a" refcount(1)
[1]=>
&array(1) refcount(1){
[0]=>
string(1) "c" refcount(1)
}
[2]=>
&array(1) refcount(1){
[0]=>
string(1) "c" refcount(1)
}
[3]=>
&string(1) "d" refcount(1)
[4]=>
&string(1) "d" refcount(1)
[5]=>
&string(1) "d" refcount(1)
[6]=>
string(1) "e" refcount(1)
[7]=>
string(1) "e" refcount(1)
[8]=>
&array(2) refcount(1){
[0]=>
string(1) "f" refcount(1)
[1]=>
&array(2) refcount(1){
[0]=>
string(1) "f" refcount(1)
[1]=>
*RECURSION*
}
}
}
===DONE===
PK �c�\T��>� � tests/apc_015.phptnu �[��� --TEST--
Copy failure should not create entry
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
try {
apcu_store('thing', function(){});
} catch(Exception $ex) {
}
var_dump(apcu_exists('thing'));
--EXPECT--
bool(false)
PK �c�\�[�� � tests/apc_003b_legacy.phptnu �[��� --TEST--
APC: apcu_store/fetch with objects
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
if (PHP_VERSION_ID >= 80100) die("skip For PHP < 8.1");
?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
class foo { }
$foo = new foo;
var_dump($foo);
apcu_store('foo',$foo);
unset($foo);
$bar = apcu_fetch('foo');
var_dump($bar);
$bar->a = true;
var_dump($bar);
class bar extends foo
{
public $pub = 'bar';
protected $pro = 'bar';
private $pri = 'bar'; // we don't see this, we'd need php 5.1 new serialization
function __construct()
{
$this->bar = true;
}
function change()
{
$this->pri = 'mod';
}
}
class baz extends bar
{
private $pri = 'baz';
function __construct()
{
parent::__construct();
$this->baz = true;
}
}
$baz = new baz;
var_dump($baz);
$baz->change();
var_dump($baz);
apcu_store('baz', $baz);
unset($baz);
var_dump(apcu_fetch('baz'));
?>
===DONE===
--EXPECTF--
object(foo)#%d (0) {
}
object(foo)#%d (0) {
}
object(foo)#%d (1) {
["a"]=>
bool(true)
}
object(baz)#%d (6) {
["pri":"baz":private]=>
string(3) "baz"
["pub"]=>
string(3) "bar"
["pro":protected]=>
string(3) "bar"
["pri":"bar":private]=>
string(3) "bar"
["bar"]=>
bool(true)
["baz"]=>
bool(true)
}
object(baz)#%d (6) {
["pri":"baz":private]=>
string(3) "baz"
["pub"]=>
string(3) "bar"
["pro":protected]=>
string(3) "bar"
["pri":"bar":private]=>
string(3) "mod"
["bar"]=>
bool(true)
["baz"]=>
bool(true)
}
object(baz)#%d (6) {
["pri":"baz":private]=>
string(3) "baz"
["pub"]=>
string(3) "bar"
["pro":protected]=>
string(3) "bar"
["pri":"bar":private]=>
string(3) "mod"
["bar"]=>
bool(true)
["baz"]=>
bool(true)
}
===DONE===
PK �c�\�
� tests/apc_entry_003.phptnu �[��� --TEST--
APC: apcu_entry (fatal error)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$value = apcu_entry("test", function($key) {
// Fatal error
class X { use T; }
});
?>
--EXPECTF--
Fatal error: %s
PK �c�\�i
� � tests/apc_entry_002.phptnu �[��� --TEST--
APC: apcu_entry (exception)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$value = apcu_entry("test", function($key){
throw new Exception($key);
});
?>
--EXPECTF--
Fatal error: Uncaught Exception: test in %s:3
Stack trace:
#0 [internal function]: {closure}('test')
#1 %s(%d): apcu_entry('test', Object(Closure))
#2 {main}
thrown in %s on line 3
PK �c�\��߿� � tests/apc_013_exists.phptnu �[��� --TEST--
APC: apcu_exists
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$kyes = "testkey";
$kno = "keytest";
apcu_store($kyes, 1);
var_dump(apcu_exists($kyes));
var_dump(apcu_exists($kno));
var_dump(apcu_exists([$kyes, $kno]));
?>
===DONE===
--EXPECT--
bool(true)
bool(false)
array(1) {
["testkey"]=>
bool(true)
}
===DONE===
PK �c�\��| | tests/ghbug185.phptnu �[��� --TEST--
APC: GH Bug #185 memory corruption
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
class MyApc
{
private $counterName = 'counter';
public function setCounterName($value)
{
$this->counterName = $value;
}
public function getCounters($name)
{
$rex = '/^' . preg_quote($name) . '\./';
$counters = array();
foreach (new \APCuIterator($rex) as $counter) {
$counters[$counter['key']] = $counter['value'];
}
return $counters;
}
public function add($key, $data, $ttl = 0)
{
$ret = apcu_store($key, $data, $ttl);
if (true !== $ret) {
throw new \UnexpectedValueException("apc_store call failed");
}
return $ret;
}
}
$myapc = new MyApc();
var_dump($counterName = uniqid());
var_dump($myapc->setCounterName($counterName));
var_dump($myapc->add($counterName.'.test', 1));
var_dump($results = $myapc->getCounters($counterName));
?>
Done
--EXPECTF--
string(%d) "%s"
NULL
bool(true)
array(1) {
["%s.test"]=>
int(1)
}
Done
PK �c�\&�y� tests/apc_entry_001.phptnu �[��� --TEST--
APC: apcu_entry (recursion)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$value = apcu_entry("test", function($key){
return apcu_entry("child", function($key) {
return "Hello World";
});
});
var_dump($value, apcu_entry("test", function($key){
return "broken";
}), apcu_entry("child", function(){
return "broken";
}));
?>
===DONE===
--EXPECT--
string(11) "Hello World"
string(11) "Hello World"
string(11) "Hello World"
===DONE===
PK �c�\@[� v v tests/apc_entry_recursion.phptnu �[��� --TEST--
Recursive apcu_* calls inside apcu_entry()
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$foo = apcu_entry('foo', function() {
apcu_store('xyz', 123);
apcu_inc('xyz');
var_dump(apcu_fetch('xyz'));
return 'bar';
});
var_dump($foo);
?>
--EXPECT--
int(124)
string(3) "bar"
PK �c�\�WF F tests/apc_017.phptnu �[��� --TEST--
APC should not preserve the IAP
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=default
--FILE--
<?php
$array = [1, 2, 3];
next($array);
apcu_store("ary", $array);
$array = apcu_fetch("ary");
var_dump(current($array));
?>
--EXPECT--
int(1)
PK �c�\"gkQ^ ^ # tests/apc_store_reference_php8.phptnu �[��� --TEST--
The outermost value should always be a value, not a reference
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=default
--SKIPIF--
<?php if (PHP_VERSION_ID < 80000) die('skip Requires PHP >= 8.0.0'); ?>
--FILE--
<?php
/* The output is different for the php serializer, because it does not replicate the
* cycle involving the top-level value. Instead the cycle is placed one level lower.
* I believe this is a bug in the php serializer. */
$value = [&$value];
apcu_store(["key" => &$value]);
$result = apcu_fetch("key");
var_dump($result);
?>
--EXPECT--
array(1) {
[0]=>
*RECURSION*
}
PK �c�\�U�@� � $ tests/apc_store_array_with_refs.phptnu �[��� --TEST--
Store array that references same value twice
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=default
--FILE--
<?php
apcu_store('test', [&$x, &$x]);
var_dump(apcu_fetch('test'));
?>
--EXPECT--
array(2) {
[0]=>
&NULL
[1]=>
&NULL
}
PK �c�\�21- tests/iterator_005.phptnu �[��� --TEST--
APC: APCIterator delete
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$vals = array();
$vals2 = array();
$it = new APCuIterator('/key[0-9]0/');
for($i = 0; $i < 41; $i++) {
apcu_store("key$i", "value$i");
}
apcu_delete($it);
$it2 = new APCuIterator();
foreach($it as $key=>$value) {
$vals[$key] = $value['key'];
}
foreach($it2 as $key=>$value) {
$vals2[$key] = $value['key'];
}
ksort($vals2);
var_dump($vals);
var_dump($vals2);
?>
===DONE===
--EXPECT--
array(0) {
}
array(37) {
["key0"]=>
string(4) "key0"
["key1"]=>
string(4) "key1"
["key11"]=>
string(5) "key11"
["key12"]=>
string(5) "key12"
["key13"]=>
string(5) "key13"
["key14"]=>
string(5) "key14"
["key15"]=>
string(5) "key15"
["key16"]=>
string(5) "key16"
["key17"]=>
string(5) "key17"
["key18"]=>
string(5) "key18"
["key19"]=>
string(5) "key19"
["key2"]=>
string(4) "key2"
["key21"]=>
string(5) "key21"
["key22"]=>
string(5) "key22"
["key23"]=>
string(5) "key23"
["key24"]=>
string(5) "key24"
["key25"]=>
string(5) "key25"
["key26"]=>
string(5) "key26"
["key27"]=>
string(5) "key27"
["key28"]=>
string(5) "key28"
["key29"]=>
string(5) "key29"
["key3"]=>
string(4) "key3"
["key31"]=>
string(5) "key31"
["key32"]=>
string(5) "key32"
["key33"]=>
string(5) "key33"
["key34"]=>
string(5) "key34"
["key35"]=>
string(5) "key35"
["key36"]=>
string(5) "key36"
["key37"]=>
string(5) "key37"
["key38"]=>
string(5) "key38"
["key39"]=>
string(5) "key39"
["key4"]=>
string(4) "key4"
["key5"]=>
string(4) "key5"
["key6"]=>
string(4) "key6"
["key7"]=>
string(4) "key7"
["key8"]=>
string(4) "key8"
["key9"]=>
string(4) "key9"
}
===DONE===
PK �c�\4�/ / tests/apc_007.phptnu �[��� --TEST--
APC: apcu_inc/apcu_dec test
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_store('foobar',2);
echo "\$foobar = 2 \n";
echo "\$foobar += 1 = ".apcu_inc('foobar')."\n";
echo "\$foobar += 10 = ".apcu_inc('foobar', 10)."\n";
echo "\$foobar -= 1 = ".apcu_dec('foobar')."\n";
echo "\$foobar -= 10 = ".apcu_dec('foobar',10)."\n";
echo "\$f__bar += 1 = ".(apcu_inc('f__bar')?"ok":"fail")."\n";
apcu_store('perfection', "xyz");
echo "\$perfection -= 1 = ".(apcu_inc('perfection')?"ok":"epic fail")."\n";
$success = false;
echo "\$foobar += 1 = ".apcu_inc('foobar', 1, $success)."\n";
echo "pass by ref success ". $success . "\n";
echo "\$foobar -= 1 = ".apcu_dec('foobar', 1, $success)."\n";
echo "pass by ref success ". $success . "\n";
?>
===DONE===
--EXPECT--
$foobar = 2
$foobar += 1 = 3
$foobar += 10 = 13
$foobar -= 1 = 12
$foobar -= 10 = 2
$f__bar += 1 = ok
$perfection -= 1 = epic fail
$foobar += 1 = 3
pass by ref success 1
$foobar -= 1 = 2
pass by ref success 1
===DONE===
PK �c�\|]��~ ~ tests/iterator_009.phptnu �[��� --TEST--
APC: APCIterator key invalidated between key() calls
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_store("foo", 0);
$it = new APCuIterator();
$it->rewind();
var_dump($it->key());
apcu_delete("foo");
apcu_store("bar", 0);
var_dump($it->key());
?>
--EXPECT--
string(3) "foo"
string(3) "foo"
PK �c�\a�� tests/bad/abc.datanu �[��� s:3:"123
PK �c�\�/,� � tests/apc_023.phptnu �[��� --TEST--
Serialization edge cases
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
echo "GLOBALS:\n";
$foo = 1;
apcu_store("key", $GLOBALS);
$globals = apcu_fetch("key");
var_dump($globals['foo']);
echo "Object referential identity:\n";
$obj = new stdClass;
$obj2 = new stdClass;
$obj2->obj = $obj;
$ary = [$obj, $obj2];
apcu_store("key", $ary);
// $obj and $obj2->obj should have the same ID
var_dump(apcu_fetch("key"));
echo "Array next free element:\n";
$ary = [0, 1];
unset($ary[1]);
apcu_store("key", $ary);
$ary = apcu_fetch("key");
// This should use key 1 rather than 2, as
// nextFreeElement should not be preserved (serialization does not)
$ary[] = 1;
var_dump($ary);
echo "Resources:\n";
apcu_store("key", fopen(__FILE__, "r"));
?>
--EXPECTF--
GLOBALS:
int(1)
Object referential identity:
array(2) {
[0]=>
object(stdClass)#3 (0) {
}
[1]=>
object(stdClass)#4 (1) {
["obj"]=>
object(stdClass)#3 (0) {
}
}
}
Array next free element:
array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
Resources:
Warning: apcu_store(): Cannot store resources in apcu cache in %s on line %d
PK �c�\���Ql l tests/apc_022.phptnu �[��� --TEST--
apcu_inc/dec() TTL parameter
--SKIPIF--
<?php
require_once(__DIR__ . '/skipif.inc');
if (!function_exists('apcu_inc_request_time')) die('skip APC debug build required');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.use_request_time=1
apc.ttl=0
--FILE--
<?php
$ttl = 1;
apcu_store("a", 0, $ttl);
apcu_store("b", 0, $ttl);
for ($i = 0; $i < 6; $i++) {
echo "T+$i:\n";
var_dump(apcu_inc("a"));
var_dump(apcu_inc("b", 1, $success, $ttl));
apcu_inc_request_time(1);
}
?>
--EXPECT--
T+0:
int(1)
int(1)
T+1:
int(2)
int(2)
T+2:
int(1)
int(1)
T+3:
int(2)
int(2)
T+4:
int(3)
int(1)
T+5:
int(4)
int(2)
PK �c�\���� � tests/iterator_010.phptnu �[��� --TEST--
APC: APCIterator shows entries older than global TTL
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
if (!function_exists('apcu_inc_request_time')) die('skip APC debug build required');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.use_request_time=1
apc.ttl=1
--FILE--
<?php
function printInfo() {
$it = new APCuIterator();
$keys = array_keys(iterator_to_array($it));
sort($keys);
var_dump($keys);
echo "Total: {$it->getTotalCount()}\n\n";
}
apcu_store("no_ttl", "a");
apcu_store("ttl", "a", 3);
echo "Initial state:\n";
printInfo();
echo "T+2:\n";
apcu_inc_request_time(2);
printInfo();
echo "T+4:\n";
apcu_inc_request_time(2);
printInfo();
?>
--EXPECT--
Initial state:
array(2) {
[0]=>
string(6) "no_ttl"
[1]=>
string(3) "ttl"
}
Total: 2
T+2:
array(2) {
[0]=>
string(6) "no_ttl"
[1]=>
string(3) "ttl"
}
Total: 2
T+4:
array(1) {
[0]=>
string(6) "no_ttl"
}
Total: 1
PK �c�\�95�� � tests/apc_019.phptnu �[��� --TEST--
The per-entry TTL should take precedence over the global TTL
--SKIPIF--
<?php
require_once(__DIR__ . '/skipif.inc');
if (!function_exists('apcu_inc_request_time')) die('skip APC debug build required');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.use_request_time=1
apc.ttl=1
--FILE--
<?php
/* Keys chosen to collide */
apcu_store("EzEz", 24);
apcu_store("EzFY", 42, 3);
apcu_store("FYEz", "xxx");
echo "T+2\n";
apcu_inc_request_time(2);
apcu_store("FYEz", "xxx");
var_dump(apcu_fetch("EzEz"));
var_dump(apcu_fetch("EzFY"));
echo "T+4\n";
apcu_inc_request_time(2);
apcu_store("FYEz", "xxx");
var_dump(apcu_fetch("EzEz"));
var_dump(apcu_fetch("EzFY"));
?>
--EXPECT--
T+2
bool(false)
int(42)
T+4
bool(false)
bool(false)
PK �c�\�� $O O tests/skipif.incnu �[��� <?php
if (!extension_loaded("apcu")) die("skip APCU extension not loaded");
?>
PK �c�\�P�� ! tests/get_included_files_inc1.incnu �[��� <?php
/* dummy include*/
?>
PK �c�\�Ґ� tests/apc_005c.phptnu �[��� --TEST--
APC: apcu_store/fetch with arrays with two object references
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$o = new stdClass();
$foo = array(&$o, &$o);
var_dump($foo);
apcu_store('foo',$foo);
$bar = apcu_fetch('foo');
var_dump($foo);
// $bar[0] should be a reference to $bar[1].
var_dump($bar);
$bar[0] = 'roh';
var_dump($bar);
?>
===DONE===
--EXPECT--
array(2) {
[0]=>
&object(stdClass)#1 (0) {
}
[1]=>
&object(stdClass)#1 (0) {
}
}
array(2) {
[0]=>
&object(stdClass)#1 (0) {
}
[1]=>
&object(stdClass)#1 (0) {
}
}
array(2) {
[0]=>
&object(stdClass)#2 (0) {
}
[1]=>
&object(stdClass)#2 (0) {
}
}
array(2) {
[0]=>
&string(3) "roh"
[1]=>
&string(3) "roh"
}
===DONE===
PK �c�\���4� � tests/apc_005b.phptnu �[��� --TEST--
APC: apcu_store/fetch with arrays with duplicate object
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$o = new stdClass();
$foo = array($o, $o);
var_dump($foo);
apcu_store('foo',$foo);
$bar = apcu_fetch('foo');
var_dump($foo);
// $bar[0] should be identical to $bar[1], and not a reference
var_dump($bar);
?>
===DONE===
--EXPECT--
array(2) {
[0]=>
object(stdClass)#1 (0) {
}
[1]=>
object(stdClass)#1 (0) {
}
}
array(2) {
[0]=>
object(stdClass)#1 (0) {
}
[1]=>
object(stdClass)#1 (0) {
}
}
array(2) {
[0]=>
object(stdClass)#2 (0) {
}
[1]=>
object(stdClass)#2 (0) {
}
}
===DONE===
PK �c�\ ��� � tests/ghbug335.phptnu �[��� --TEST--
GH Bug #335: APCu stampede protection is broken
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
if (!extension_loaded('pcntl')) {
die('skip pcntl required');
}
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.use_request_time=1
apc.slam_defense=1
--FILE--
<?php
// Reset slam detection.
apcu_store("foo", "parent");
$pid = pcntl_fork();
if ($pid) {
// parent
pcntl_wait($status);
} else {
// child
$ret = apcu_store("foo", "child");
if ($ret === false) {
echo "Stampede protection works\n";
} else {
echo "Stampede protection doesn't work\n";
}
exit(0);
}
?>
--EXPECT--
Stampede protection works
PK �c�\�H�I I tests/not_enough_shm.phptnu �[��� --TEST--
Error if cache structures cannot be allocated in SHM
--INI--
apc.enabled=1
apc.enable_cli=1
apc.shm_size=1M
apc.entries_hint=1000000
--FILE--
Irrelevant
--EXPECTF--
%A: Unable to allocate %d bytes of shared memory for cache structures. Either apc.shm_size is too small or apc.entries_hint too large in Unknown on line 0
PK �c�\
{a�2 2 tests/apc_010.phptnu �[��� --TEST--
APC: apcu_store/fetch/add with array of key/value pairs.
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$entries = array();
$entries['key1'] = 'value1';
$entries['key2'] = 'value2';
$entries['key3'] = array('value3a','value3b');
$entries['key4'] = 4;
var_dump(apcu_store($entries));
$cached_values = apcu_fetch(array_keys($entries));
var_dump($cached_values);
apcu_delete('key2');
apcu_delete('key4');
$cached_values = apcu_fetch(array_keys($entries));
var_dump($cached_values);
var_dump(apcu_add($entries));
$cached_values = apcu_fetch(array_keys($entries));
var_dump($cached_values);
?>
===DONE===
--EXPECT--
array(0) {
}
array(4) {
["key1"]=>
string(6) "value1"
["key2"]=>
string(6) "value2"
["key3"]=>
array(2) {
[0]=>
string(7) "value3a"
[1]=>
string(7) "value3b"
}
["key4"]=>
int(4)
}
array(2) {
["key1"]=>
string(6) "value1"
["key3"]=>
array(2) {
[0]=>
string(7) "value3a"
[1]=>
string(7) "value3b"
}
}
array(2) {
["key1"]=>
int(-1)
["key3"]=>
int(-1)
}
array(4) {
["key1"]=>
string(6) "value1"
["key2"]=>
string(6) "value2"
["key3"]=>
array(2) {
[0]=>
string(7) "value3a"
[1]=>
string(7) "value3b"
}
["key4"]=>
int(4)
}
===DONE===
PK �c�\Yn��� � tests/apc_021.phptnu �[��� --TEST--
apcu_inc/dec() should not inc/dec hard expired entries
--SKIPIF--
<?php
require_once(__DIR__ . '/skipif.inc');
if (!function_exists('apcu_inc_request_time')) die('skip APC debug build required');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.use_request_time=1
apc.ttl=1
--FILE--
<?php
apcu_store("inc", 0, 3);
apcu_store("dec", 0, 3);
echo "T+0:\n";
var_dump(apcu_inc("inc"));
var_dump(apcu_fetch("inc"));
var_dump(apcu_dec("dec"));
var_dump(apcu_fetch("dec"));
apcu_inc_request_time(2);
echo "T+2:\n";
var_dump(apcu_inc("inc"));
var_dump(apcu_fetch("inc"));
var_dump(apcu_dec("dec"));
var_dump(apcu_fetch("dec"));
apcu_inc_request_time(2);
echo "T+4\n";
var_dump(apcu_inc("inc"));
var_dump(apcu_fetch("inc"));
var_dump(apcu_dec("dec"));
var_dump(apcu_fetch("dec"));
?>
--EXPECT--
T+0:
int(1)
int(1)
int(-1)
int(-1)
T+2:
int(2)
int(2)
int(-2)
int(-2)
T+4
int(1)
int(1)
int(-1)
int(-1)
PK �c�\��~Q Q tests/apc_disabled.phptnu �[��� --TEST--
Behavior of functions when apcu is disabled
--INI--
apc.enable_cli=0
--FILE--
<?php
echo "enabled\n";
var_dump(apcu_enabled());
echo "\nclear_cache\n";
var_dump(apcu_clear_cache());
echo "\ncache/sma_info\n";
var_dump(apcu_cache_info());
var_dump(apcu_sma_info());
echo "\nstore/add/exists/fetch/key_info/delete\n";
var_dump(apcu_store("key", "value"));
var_dump(apcu_add("key", "value"));
var_dump(apcu_exists("key"));
var_dump(apcu_fetch("key"));
var_dump(apcu_key_info("key"));
var_dump(apcu_delete("key"));
echo "\nstore/add/exists/fetch/delete array\n";
var_dump(apcu_store(["key" => "value"]));
var_dump(apcu_add(["key" => "value"]));
var_dump(apcu_exists(["key"]));
var_dump(apcu_fetch(["key"]));
var_dump(apcu_delete(["key"]));
echo "\ninc/dec/cas\n";
var_dump(apcu_inc("key", 1, $succ_inc));
var_dump($succ_inc);
var_dump(apcu_dec("key", 1, $succ_dec));
var_dump($succ_dec);
var_dump(apcu_cas("key", 10, 20));
echo "\nentry\n";
var_dump(apcu_entry("key", function() { return 42; }));
echo "\niterator\n";
try {
new APCUIterator;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
enabled
bool(false)
clear_cache
bool(true)
cache/sma_info
Warning: apcu_cache_info(): No APC info available. Perhaps APC is not enabled? Check apc.enabled in your ini file in %s on line %d
bool(false)
Warning: apcu_sma_info(): No APC SMA info available. Perhaps APC is disabled via apc.enabled? in %s on line %d
bool(false)
store/add/exists/fetch/key_info/delete
bool(false)
bool(false)
bool(false)
bool(false)
NULL
bool(false)
store/add/exists/fetch/delete array
array(1) {
["key"]=>
int(-1)
}
array(1) {
["key"]=>
int(-1)
}
array(0) {
}
array(0) {
}
array(1) {
[0]=>
string(3) "key"
}
inc/dec/cas
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
entry
NULL
iterator
APC must be enabled to use APCUIterator
PK �c�\���Q� � tests/apc_003b.phptnu �[��� --TEST--
APC: apcu_store/fetch with objects
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
if (PHP_VERSION_ID < 80100) die("skip For PHP >= 8.1");
?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
#[AllowDynamicProperties]
class foo { }
$foo = new foo;
var_dump($foo);
apcu_store('foo',$foo);
unset($foo);
$bar = apcu_fetch('foo');
var_dump($bar);
$bar->a = true;
var_dump($bar);
#[AllowDynamicProperties]
class bar extends foo
{
public $pub = 'bar';
protected $pro = 'bar';
private $pri = 'bar'; // we don't see this, we'd need php 5.1 new serialization
function __construct()
{
$this->bar = true;
}
function change()
{
$this->pri = 'mod';
}
}
class baz extends bar
{
private $pri = 'baz';
function __construct()
{
parent::__construct();
$this->baz = true;
}
}
$baz = new baz;
var_dump($baz);
$baz->change();
var_dump($baz);
apcu_store('baz', $baz);
unset($baz);
var_dump(apcu_fetch('baz'));
?>
===DONE===
--EXPECTF--
object(foo)#%d (0) {
}
object(foo)#%d (0) {
}
object(foo)#%d (1) {
["a"]=>
bool(true)
}
object(baz)#%d (6) {
["pub"]=>
string(3) "bar"
["pro":protected]=>
string(3) "bar"
["pri":"bar":private]=>
string(3) "bar"
["pri":"baz":private]=>
string(3) "baz"
["bar"]=>
bool(true)
["baz"]=>
bool(true)
}
object(baz)#%d (6) {
["pub"]=>
string(3) "bar"
["pro":protected]=>
string(3) "bar"
["pri":"bar":private]=>
string(3) "mod"
["pri":"baz":private]=>
string(3) "baz"
["bar"]=>
bool(true)
["baz"]=>
bool(true)
}
object(baz)#%d (6) {
["pub"]=>
string(3) "bar"
["pro":protected]=>
string(3) "bar"
["pri":"bar":private]=>
string(3) "mod"
["pri":"baz":private]=>
string(3) "baz"
["bar"]=>
bool(true)
["baz"]=>
bool(true)
}
===DONE===
PK �c�\���m� � tests/apc_004.phptnu �[��� --TEST--
APC: apcu_store/fetch with bools
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$foo = false;
var_dump($foo); /* false */
apcu_store('foo',$foo);
//$success = "some string";
$bar = apcu_fetch('foo', $success);
var_dump($foo); /* false */
var_dump($bar); /* false */
var_dump($success); /* true */
$bar = apcu_fetch('not foo', $success);
var_dump($foo); /* false */
var_dump($bar); /* false */
var_dump($success); /* false */
?>
===DONE===
--EXPECT--
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
bool(false)
===DONE===
PK �c�\"�� � tests/apc_018.phptnu �[��� --TEST--
apc_cas() inserts non-existing key with value 0
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_cas("foo", 42, 24);
var_dump(apcu_fetch("foo"));
?>
--EXPECT--
bool(false)
PK �c�\�+� tests/iterator_002.phptnu �[��� --TEST--
APC: APCIterator regex
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$it = new APCuIterator('/key[0-9]0/');
for($i = 0; $i < 41; $i++) {
apcu_store("key$i", "value$i");
}
foreach($it as $key=>$value) {
$vals[$key] = $value['key'];
}
ksort($vals);
var_dump($vals);
?>
===DONE===
--EXPECT--
array(4) {
["key10"]=>
string(5) "key10"
["key20"]=>
string(5) "key20"
["key30"]=>
string(5) "key30"
["key40"]=>
string(5) "key40"
}
===DONE===
PK �c�\�%�e e tests/apc_016.phptnu �[��� --TEST--
Should be able to pass references to strings to apcu_fetch
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$array = ['foo', 'bar'];
var_dump(apcu_store('foo', 'baz'));
var_dump(apcu_fetch($array));
var_dump(error_get_last());
array_walk($array, function(&$item) {});
var_dump($array);
var_dump(apcu_fetch($array));
var_dump(error_get_last());
?>
--EXPECT--
bool(true)
array(1) {
["foo"]=>
string(3) "baz"
}
NULL
array(2) {
[0]=>
string(3) "foo"
[1]=>
string(3) "bar"
}
array(1) {
["foo"]=>
string(3) "baz"
}
NULL
PK �c�\|ι� � tests/ghbug168.phptnu �[��� --TEST--
gh bug #168
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_store('prop', 'A');
var_dump($prop = apcu_fetch('prop'));
apcu_store('prop', ['B']);
var_dump(apcu_fetch('prop'), $prop);
apcu_store('thing', ['C']);
var_dump(apcu_fetch('prop'), $prop);
--EXPECT--
string(1) "A"
array(1) {
[0]=>
string(1) "B"
}
string(1) "A"
array(1) {
[0]=>
string(1) "B"
}
string(1) "A"
PK �c�\E��T� � + tests/apcu_fetch_empty_array_reference.phptnu �[��� --TEST--
apcu_fetch should work for multiple reference groups
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$x = [];
$y = [];
$array = [&$x, &$x, &$y, &$y];
apcu_store("ary", $array);
$copy = apcu_fetch("ary");
$copy[0][1] = new stdClass();
var_dump($array);
var_dump($copy);
?>
--EXPECT--
array(4) {
[0]=>
&array(0) {
}
[1]=>
&array(0) {
}
[2]=>
&array(0) {
}
[3]=>
&array(0) {
}
}
array(4) {
[0]=>
&array(1) {
[1]=>
object(stdClass)#1 (0) {
}
}
[1]=>
&array(1) {
[1]=>
object(stdClass)#1 (0) {
}
}
[2]=>
&array(0) {
}
[3]=>
&array(0) {
}
}
PK �c�\�R
� � tests/ghbug335-fail.phptnu �[��� --TEST--
GH Bug #335: APCu stampede protection is broken
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
if (!extension_loaded('pcntl')) {
die('skip pcntl required');
}
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.use_request_time=1
apc.slam_defense=0
--FILE--
<?php
// Reset slam detection.
apcu_store("foo", "parent");
$pid = pcntl_fork();
if ($pid) {
// parent
pcntl_wait($status);
} else {
// child
$ret = apcu_store("foo", "child");
if ($ret === false) {
echo "Stampede protection works\n";
} else {
echo "Stampede protection doesn't work\n";
}
exit(0);
}
?>
--EXPECT--
Stampede protection doesn't work
PK �c�\��L�� � tests/server_test.incnu �[��� <?php
/* based on sapi/cli/tests/php_cli_server.inc */
define ("PHP_CLI_SERVER_HOSTNAME", "127.0.0.1");
define ("PHP_CLI_SERVER_PORT", 8000 + PHP_INT_SIZE*1000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10);
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
/* XXX incapsulate all this globals into a class when have a favourable minute */
$doc_root = __DIR__;
$router = "index.php";
$handles = array();
$ports = array();
$num_servers = 3;
function server_start_one($host, $port, $code = 'echo "Hello world";', $php_opts = array(), $no_router = FALSE)
{
global $doc_root, $router, $handles, $ports;
$php_executable = getenv('TEST_PHP_EXECUTABLE');
$php_args = getenv('TEST_PHP_ARGS');
$descriptorspec = array(
0 => STDIN,
1 => STDOUT,
2 => STDERR,
);
if (!$php_args) {
$ext = (substr(PHP_OS, 0, 3) == 'WIN') ? 'php_apcu.dll' : 'apcu.so';
if (substr(PHP_OS, 0, 3) == 'WIN') {
$part0 = 8 == PHP_INT_SIZE ? "x64" : "";
$part1 = ZEND_DEBUG_BUILD ? "Debug" : "Release";
$part1 = PHP_ZTS ? ($part1 . "_TS") : $part1;
$php_args = "-d extension_dir=$doc_root/../$part0/$part1";
} else {
$php_args = "-d extension_dir=$doc_root/../modules";
}
$php_args = "$php_args -d extension=$ext";
}
if ($php_opts) {
$php_args = "$php_args -d " . implode(' -d ', $php_opts);;
}
if (substr(PHP_OS, 0, 3) == 'WIN') {
$cmd = "{$php_executable} -n $php_args -t {$doc_root} -S $host:$port";
if (!$no_router) {
$cmd .= " {$router}";
}
$descriptorspec[2] = array('pipe', 'w');
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
} else {
$cmd = "exec {$php_executable} -n $php_args -t {$doc_root} -S $host:$port";
if (!$no_router) {
$cmd .= " {$doc_root}/{$router}";
}
$cmd .= " 2>/dev/null";
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
}
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
// it might not be listening yet...need to wait until fsockopen() call returns
// Let this wait for up to 10 seconds to avoid spurious failures with valgrind.
$i = 0;
while (($i++ < 100) && !connection_test($host, $port)) {
usleep(100000);
}
return $handle;
}
function server_start($code = 'echo "Hello world";', $php_opts = array(), $no_router = FALSE)
{
global $doc_root, $router, $handles, $ports, $num_servers;
if ($code) {
file_put_contents($doc_root . '/' . $router, '<?php ' . $code . ' ?>');
}
for ($i = 0; $i < $num_servers; $i++) {
$h = server_start_one(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT+$i, $code, $php_opts, $no_router);
$handles[] = $h;
}
register_shutdown_function(
function($handles) use($router) {
foreach ($handles as $handle) {
proc_terminate($handle);
}
@unlink(__DIR__ . "/{$router}");
},
$handles
);
// don't bother sleeping, server is already up
// server can take a variable amount of time to be up, so just sleeping a guessed amount of time
// does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass
// sleeping doesn't work.
}
function get_response($fp, $data_only = true)
{
$s = '';
while (!feof($fp)) {
$s .= fgets($fp);
}
if ($data_only) {
$parts = explode("\r\n\r\n", $s);
$s = $parts[1];
}
return $s;
}
function connection_test($host, $port)
{
$port = intval($port)?:80;
$fp = @fsockopen($host, $port, $errno, $errstr, 10);
if (!$fp) {
return false;
}
$send = "GET / HTTP/1.1\nHost: {$host}\r\n\r\n";
/* will not out here, just test if the connection has worked*/
if(@fwrite($fp, $send)) {
get_response($fp);
fclose($fp);
return true;
}
@fclose($fp);
return false;
}
function run_test_simple($request_uri = NULL)
{
global $num_servers;
$send = "GET /" . $request_uri ." HTTP/1.1\nHost: " . PHP_CLI_SERVER_HOSTNAME . "\r\n\r\n";
for ($i = 0; $i < $num_servers; $i++) {
run_test(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT+$i, $send);
}
}
function run_test($host, $port, $send)
{
$fp = fsockopen($host, $port, $errno, $errstr, 10);
if (!$fp) {
die(sprintf("connect failed errno=%d errstr='%s'", $errno, $errstr));
}
if(fwrite($fp, $send)) {
echo get_response($fp);
}
fclose($fp);
}
PK �c�\�O�h{ { tests/apc_store_reference.phptnu �[��� --TEST--
The outermost value should always be a value, not a reference
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=default
--SKIPIF--
<?php if (PHP_VERSION_ID >= 80000) die('skip Requires PHP < 8.0.0'); ?>
--FILE--
<?php
/* The output is different for the php serializer, because it does not replicate the
* cycle involving the top-level value. Instead the cycle is placed one level lower.
* I believe this is a bug in the php serializer. */
$value = [&$value];
apcu_store(["key" => &$value]);
$result = apcu_fetch("key");
var_dump($result);
?>
--EXPECT--
array(1) {
[0]=>
array(1) {
[0]=>
*RECURSION*
}
}
PK �c�\/� K� � tests/ghbug248.phptnu �[��� --TEST--
GH Bug #248: apcu_fetch may return values causing zend_mm_corruption or segfaults when custom serializer is used
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=default
--FILE--
<?php
function build_array() {
return [
'params' => 2,
'construct' => ['a'],
'x1' => 'y',
'x2' => 'y',
'x3' => 'y',
'x4' => 'y',
'x5' => 'y',
'x6' => 0,
];
}
class MyClass {
private $_params;
public function __construct($params) {
var_dump($params);
$this->_params = $params;
var_dump($params);
$this->_params['ids'] = [4];
$this->_params['loadValue'] = 'x';
unset($this->_params['params']);
}
}
function setup() {
apcu_delete('mytestkey');
apcu_store('mytestkey', build_array());
}
function test_apcu_fetch() {
// Or store second?
$value = apcu_fetch('mytestkey');
echo "Fetching the value initially stored into apcu:\n";
var_dump($value);
echo "Done dumping initial fetch\n\n";
new MyClass($value);
echo "\$value was passed by value, not reference. After instantiating class, the array \$value gets modified\n";
var_dump($value);
echo "\nAnd calling apcu_fetch again, the original data is preserved (8 keys, params=2)\n";
var_dump(apcu_fetch('mytestkey'));
}
setup();
test_apcu_fetch();
?>
--EXPECT--
Fetching the value initially stored into apcu:
array(8) {
["params"]=>
int(2)
["construct"]=>
array(1) {
[0]=>
string(1) "a"
}
["x1"]=>
string(1) "y"
["x2"]=>
string(1) "y"
["x3"]=>
string(1) "y"
["x4"]=>
string(1) "y"
["x5"]=>
string(1) "y"
["x6"]=>
int(0)
}
Done dumping initial fetch
array(8) {
["params"]=>
int(2)
["construct"]=>
array(1) {
[0]=>
string(1) "a"
}
["x1"]=>
string(1) "y"
["x2"]=>
string(1) "y"
["x3"]=>
string(1) "y"
["x4"]=>
string(1) "y"
["x5"]=>
string(1) "y"
["x6"]=>
int(0)
}
array(8) {
["params"]=>
int(2)
["construct"]=>
array(1) {
[0]=>
string(1) "a"
}
["x1"]=>
string(1) "y"
["x2"]=>
string(1) "y"
["x3"]=>
string(1) "y"
["x4"]=>
string(1) "y"
["x5"]=>
string(1) "y"
["x6"]=>
int(0)
}
$value was passed by value, not reference. After instantiating class, the array $value gets modified
array(8) {
["params"]=>
int(2)
["construct"]=>
array(1) {
[0]=>
string(1) "a"
}
["x1"]=>
string(1) "y"
["x2"]=>
string(1) "y"
["x3"]=>
string(1) "y"
["x4"]=>
string(1) "y"
["x5"]=>
string(1) "y"
["x6"]=>
int(0)
}
And calling apcu_fetch again, the original data is preserved (8 keys, params=2)
array(8) {
["params"]=>
int(2)
["construct"]=>
array(1) {
[0]=>
string(1) "a"
}
["x1"]=>
string(1) "y"
["x2"]=>
string(1) "y"
["x3"]=>
string(1) "y"
["x4"]=>
string(1) "y"
["x5"]=>
string(1) "y"
["x6"]=>
int(0)
}
PK �c�\�J� tests/iterator_003.phptnu �[��� --TEST--
APC: APCIterator chunk size
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$it = new APCuIterator(NULL, APC_ITER_ALL, 10);
for($i = 0; $i < 41; $i++) {
apcu_store("key$i", "value$i");
}
foreach($it as $key=>$value) {
$vals[$key] = $value['key'];
}
ksort($vals);
var_dump($vals);
?>
===DONE===
--EXPECT--
array(41) {
["key0"]=>
string(4) "key0"
["key1"]=>
string(4) "key1"
["key10"]=>
string(5) "key10"
["key11"]=>
string(5) "key11"
["key12"]=>
string(5) "key12"
["key13"]=>
string(5) "key13"
["key14"]=>
string(5) "key14"
["key15"]=>
string(5) "key15"
["key16"]=>
string(5) "key16"
["key17"]=>
string(5) "key17"
["key18"]=>
string(5) "key18"
["key19"]=>
string(5) "key19"
["key2"]=>
string(4) "key2"
["key20"]=>
string(5) "key20"
["key21"]=>
string(5) "key21"
["key22"]=>
string(5) "key22"
["key23"]=>
string(5) "key23"
["key24"]=>
string(5) "key24"
["key25"]=>
string(5) "key25"
["key26"]=>
string(5) "key26"
["key27"]=>
string(5) "key27"
["key28"]=>
string(5) "key28"
["key29"]=>
string(5) "key29"
["key3"]=>
string(4) "key3"
["key30"]=>
string(5) "key30"
["key31"]=>
string(5) "key31"
["key32"]=>
string(5) "key32"
["key33"]=>
string(5) "key33"
["key34"]=>
string(5) "key34"
["key35"]=>
string(5) "key35"
["key36"]=>
string(5) "key36"
["key37"]=>
string(5) "key37"
["key38"]=>
string(5) "key38"
["key39"]=>
string(5) "key39"
["key4"]=>
string(4) "key4"
["key40"]=>
string(5) "key40"
["key5"]=>
string(4) "key5"
["key6"]=>
string(4) "key6"
["key7"]=>
string(4) "key7"
["key8"]=>
string(4) "key8"
["key9"]=>
string(4) "key9"
}
===DONE===
PK �c�\-���W W ! tests/get_included_files_inc3.incnu �[��� <?php
/* dummy include*/
include(dirname(__FILE__)."/get_included_files_inc1.inc");
?>
PK �c�\�� � tests/typed_prop.phptnu �[��� --TEST--
Success parameters should respect property types
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
version_compare(PHP_VERSION, '7.4.0dev', '>=') or die('skip Requires PHP >= 7.4');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
class Test {
public bool $bool = false;
public array $array = [];
}
$test = new Test;
apcu_store('foo', 'bar');
apcu_fetch('foo', $test->bool);
var_dump($test->bool);
try {
apcu_fetch('foo', $test->array);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($test->array);
?>
--EXPECTF--
bool(true)
Cannot assign %s to reference held by property Test::$array of type array
array(0) {
}
PK �c�\-�}B B tests/iterator_006.phptnu �[��� --TEST--
APC: APCIterator formats
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.user_entries_hint=4096
--FILE--
<?php
$formats = array(
APC_ITER_KEY,
APC_ITER_VALUE,
APC_ITER_NUM_HITS,
APC_ITER_MTIME,
APC_ITER_CTIME,
APC_ITER_DTIME,
APC_ITER_ATIME,
APC_ITER_REFCOUNT,
APC_ITER_MEM_SIZE,
APC_ITER_TTL,
APC_ITER_NONE,
APC_ITER_ALL & ~APC_ITER_TYPE,
APC_ITER_ALL & ~APC_ITER_TTL & ~APC_ITER_TYPE,
APC_ITER_KEY | APC_ITER_NUM_HITS | APC_ITER_MEM_SIZE,
);
$it_array = array();
foreach ($formats as $idx => $format) {
$it_array[$idx] = new APCuIterator(NULL, $format);
}
for($i = 0; $i < 11; $i++) {
apcu_store("key$i", "value$i");
}
foreach ($it_array as $idx => $it) {
print_it($it, $idx);
}
function print_it($it, $idx) {
echo "IT #$idx\n";
echo "============================\n";
foreach ($it as $key=>$value) {
var_dump($key);
var_dump($value);
}
echo "============================\n\n";
}
?>
===DONE===
--EXPECTF--
IT #0
============================
string(4) "key0"
array(1) {
["key"]=>
string(4) "key0"
}
string(4) "key1"
array(1) {
["key"]=>
string(4) "key1"
}
string(4) "key2"
array(1) {
["key"]=>
string(4) "key2"
}
string(4) "key3"
array(1) {
["key"]=>
string(4) "key3"
}
string(4) "key4"
array(1) {
["key"]=>
string(4) "key4"
}
string(4) "key5"
array(1) {
["key"]=>
string(4) "key5"
}
string(4) "key6"
array(1) {
["key"]=>
string(4) "key6"
}
string(4) "key7"
array(1) {
["key"]=>
string(4) "key7"
}
string(4) "key8"
array(1) {
["key"]=>
string(4) "key8"
}
string(4) "key9"
array(1) {
["key"]=>
string(4) "key9"
}
string(5) "key10"
array(1) {
["key"]=>
string(5) "key10"
}
============================
IT #1
============================
string(4) "key0"
array(1) {
["value"]=>
string(6) "value0"
}
string(4) "key1"
array(1) {
["value"]=>
string(6) "value1"
}
string(4) "key2"
array(1) {
["value"]=>
string(6) "value2"
}
string(4) "key3"
array(1) {
["value"]=>
string(6) "value3"
}
string(4) "key4"
array(1) {
["value"]=>
string(6) "value4"
}
string(4) "key5"
array(1) {
["value"]=>
string(6) "value5"
}
string(4) "key6"
array(1) {
["value"]=>
string(6) "value6"
}
string(4) "key7"
array(1) {
["value"]=>
string(6) "value7"
}
string(4) "key8"
array(1) {
["value"]=>
string(6) "value8"
}
string(4) "key9"
array(1) {
["value"]=>
string(6) "value9"
}
string(5) "key10"
array(1) {
["value"]=>
string(7) "value10"
}
============================
IT #2
============================
string(4) "key0"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key1"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key2"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key3"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key4"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key5"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key6"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key7"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key8"
array(1) {
["num_hits"]=>
int(0)
}
string(4) "key9"
array(1) {
["num_hits"]=>
int(0)
}
string(5) "key10"
array(1) {
["num_hits"]=>
int(0)
}
============================
IT #3
============================
string(4) "key0"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key1"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key2"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key3"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key4"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key5"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key6"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key7"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key8"
array(1) {
["mtime"]=>
int(%d)
}
string(4) "key9"
array(1) {
["mtime"]=>
int(%d)
}
string(5) "key10"
array(1) {
["mtime"]=>
int(%d)
}
============================
IT #4
============================
string(4) "key0"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key1"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key2"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key3"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key4"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key5"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key6"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key7"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key8"
array(1) {
["creation_time"]=>
int(%d)
}
string(4) "key9"
array(1) {
["creation_time"]=>
int(%d)
}
string(5) "key10"
array(1) {
["creation_time"]=>
int(%d)
}
============================
IT #5
============================
string(4) "key0"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key1"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key2"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key3"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key4"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key5"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key6"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key7"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key8"
array(1) {
["deletion_time"]=>
int(0)
}
string(4) "key9"
array(1) {
["deletion_time"]=>
int(0)
}
string(5) "key10"
array(1) {
["deletion_time"]=>
int(0)
}
============================
IT #6
============================
string(4) "key0"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key1"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key2"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key3"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key4"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key5"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key6"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key7"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key8"
array(1) {
["access_time"]=>
int(%d)
}
string(4) "key9"
array(1) {
["access_time"]=>
int(%d)
}
string(5) "key10"
array(1) {
["access_time"]=>
int(%d)
}
============================
IT #7
============================
string(4) "key0"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key1"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key2"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key3"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key4"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key5"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key6"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key7"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key8"
array(1) {
["ref_count"]=>
int(0)
}
string(4) "key9"
array(1) {
["ref_count"]=>
int(0)
}
string(5) "key10"
array(1) {
["ref_count"]=>
int(0)
}
============================
IT #8
============================
string(4) "key0"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key1"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key2"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key3"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key4"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key5"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key6"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key7"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key8"
array(1) {
["mem_size"]=>
int(%d)
}
string(4) "key9"
array(1) {
["mem_size"]=>
int(%d)
}
string(5) "key10"
array(1) {
["mem_size"]=>
int(%d)
}
============================
IT #9
============================
string(4) "key0"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key1"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key2"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key3"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key4"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key5"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key6"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key7"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key8"
array(1) {
["ttl"]=>
int(0)
}
string(4) "key9"
array(1) {
["ttl"]=>
int(0)
}
string(5) "key10"
array(1) {
["ttl"]=>
int(0)
}
============================
IT #10
============================
string(4) "key0"
array(0) {
}
string(4) "key1"
array(0) {
}
string(4) "key2"
array(0) {
}
string(4) "key3"
array(0) {
}
string(4) "key4"
array(0) {
}
string(4) "key5"
array(0) {
}
string(4) "key6"
array(0) {
}
string(4) "key7"
array(0) {
}
string(4) "key8"
array(0) {
}
string(4) "key9"
array(0) {
}
string(5) "key10"
array(0) {
}
============================
IT #11
============================
string(4) "key0"
array(10) {
["key"]=>
string(4) "key0"
["value"]=>
string(6) "value0"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key1"
array(10) {
["key"]=>
string(4) "key1"
["value"]=>
string(6) "value1"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key2"
array(10) {
["key"]=>
string(4) "key2"
["value"]=>
string(6) "value2"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key3"
array(10) {
["key"]=>
string(4) "key3"
["value"]=>
string(6) "value3"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key4"
array(10) {
["key"]=>
string(4) "key4"
["value"]=>
string(6) "value4"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key5"
array(10) {
["key"]=>
string(4) "key5"
["value"]=>
string(6) "value5"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key6"
array(10) {
["key"]=>
string(4) "key6"
["value"]=>
string(6) "value6"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key7"
array(10) {
["key"]=>
string(4) "key7"
["value"]=>
string(6) "value7"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key8"
array(10) {
["key"]=>
string(4) "key8"
["value"]=>
string(6) "value8"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(4) "key9"
array(10) {
["key"]=>
string(4) "key9"
["value"]=>
string(6) "value9"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
string(5) "key10"
array(10) {
["key"]=>
string(5) "key10"
["value"]=>
string(7) "value10"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
["ttl"]=>
int(0)
}
============================
IT #12
============================
string(4) "key0"
array(9) {
["key"]=>
string(4) "key0"
["value"]=>
string(6) "value0"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key1"
array(9) {
["key"]=>
string(4) "key1"
["value"]=>
string(6) "value1"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key2"
array(9) {
["key"]=>
string(4) "key2"
["value"]=>
string(6) "value2"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key3"
array(9) {
["key"]=>
string(4) "key3"
["value"]=>
string(6) "value3"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key4"
array(9) {
["key"]=>
string(4) "key4"
["value"]=>
string(6) "value4"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key5"
array(9) {
["key"]=>
string(4) "key5"
["value"]=>
string(6) "value5"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key6"
array(9) {
["key"]=>
string(4) "key6"
["value"]=>
string(6) "value6"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key7"
array(9) {
["key"]=>
string(4) "key7"
["value"]=>
string(6) "value7"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key8"
array(9) {
["key"]=>
string(4) "key8"
["value"]=>
string(6) "value8"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key9"
array(9) {
["key"]=>
string(4) "key9"
["value"]=>
string(6) "value9"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(5) "key10"
array(9) {
["key"]=>
string(5) "key10"
["value"]=>
string(7) "value10"
["num_hits"]=>
int(0)
["mtime"]=>
int(%d)
["creation_time"]=>
int(%d)
["deletion_time"]=>
int(0)
["access_time"]=>
int(%d)
["ref_count"]=>
int(0)
["mem_size"]=>
int(%d)
}
============================
IT #13
============================
string(4) "key0"
array(3) {
["key"]=>
string(4) "key0"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key1"
array(3) {
["key"]=>
string(4) "key1"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key2"
array(3) {
["key"]=>
string(4) "key2"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key3"
array(3) {
["key"]=>
string(4) "key3"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key4"
array(3) {
["key"]=>
string(4) "key4"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key5"
array(3) {
["key"]=>
string(4) "key5"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key6"
array(3) {
["key"]=>
string(4) "key6"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key7"
array(3) {
["key"]=>
string(4) "key7"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key8"
array(3) {
["key"]=>
string(4) "key8"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(4) "key9"
array(3) {
["key"]=>
string(4) "key9"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
string(5) "key10"
array(3) {
["key"]=>
string(5) "key10"
["num_hits"]=>
int(0)
["mem_size"]=>
int(%d)
}
============================
===DONE===
PK �c�\�H^G G tests/apcu_sma_info.phptnu �[��� --TEST--
Basic apcu_sma_info() test
--INI--
apc.enabled=1
apc.enable_cli=1
apc.shm_segments=1
--FILE--
<?php
apcu_store("key", "value");
var_dump(apcu_sma_info(true));
var_dump(apcu_sma_info());
?>
--EXPECTF--
array(3) {
["num_seg"]=>
int(1)
["seg_size"]=>
float(%s)
["avail_mem"]=>
float(%s)
}
array(4) {
["num_seg"]=>
int(1)
["seg_size"]=>
float(%s)
["avail_mem"]=>
float(%s)
["block_lists"]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(2) {
["size"]=>
int(%d)
["offset"]=>
int(%d)
}
}
}
}
PK �c�\Wb�N^ ^ tests/apc_012.phptnu �[��� --TEST--
APC: Atomic inc + dec wrap around on overflow
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$key = "testkey";
apcu_store($key, PHP_INT_MAX);
var_dump($i = apcu_inc($key, 1));
var_dump($j = apcu_fetch($key));
var_dump($i == $j);
var_dump($j == PHP_INT_MIN);
apcu_store($key, PHP_INT_MIN);
var_dump($i = apcu_dec($key, 1));
var_dump($j = apcu_fetch($key));
var_dump($i == $j);
var_dump($j == PHP_INT_MAX);
?>
===DONE===
--EXPECTF--
int(%i)
int(%i)
bool(true)
bool(true)
int(%i)
int(%i)
bool(true)
bool(true)
===DONE===
PK �c�\5Y��� � tests/apc_025.phptnu �[��� --TEST--
APC: apcu_fetch of packed array
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
var_dump(apcu_store('foo', [1, 2, 3, 4, 5, 6, 7, 8]));
var_dump(apcu_fetch('foo'));
?>
--EXPECT--
bool(true)
array(8) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
[5]=>
int(6)
[6]=>
int(7)
[7]=>
int(8)
}
PK �c�\4@"� � tests/iterator_001.phptnu �[��� --TEST--
APC: APCIterator general
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$it = new APCuIterator();
for($i = 0; $i < 41; $i++) {
apcu_store("key$i", "value$i");
}
foreach($it as $key=>$value) {
$keys[$key] = $value['key'];
}
ksort($keys);
var_dump($keys);
?>
===DONE===
--EXPECT--
array(41) {
["key0"]=>
string(4) "key0"
["key1"]=>
string(4) "key1"
["key10"]=>
string(5) "key10"
["key11"]=>
string(5) "key11"
["key12"]=>
string(5) "key12"
["key13"]=>
string(5) "key13"
["key14"]=>
string(5) "key14"
["key15"]=>
string(5) "key15"
["key16"]=>
string(5) "key16"
["key17"]=>
string(5) "key17"
["key18"]=>
string(5) "key18"
["key19"]=>
string(5) "key19"
["key2"]=>
string(4) "key2"
["key20"]=>
string(5) "key20"
["key21"]=>
string(5) "key21"
["key22"]=>
string(5) "key22"
["key23"]=>
string(5) "key23"
["key24"]=>
string(5) "key24"
["key25"]=>
string(5) "key25"
["key26"]=>
string(5) "key26"
["key27"]=>
string(5) "key27"
["key28"]=>
string(5) "key28"
["key29"]=>
string(5) "key29"
["key3"]=>
string(4) "key3"
["key30"]=>
string(5) "key30"
["key31"]=>
string(5) "key31"
["key32"]=>
string(5) "key32"
["key33"]=>
string(5) "key33"
["key34"]=>
string(5) "key34"
["key35"]=>
string(5) "key35"
["key36"]=>
string(5) "key36"
["key37"]=>
string(5) "key37"
["key38"]=>
string(5) "key38"
["key39"]=>
string(5) "key39"
["key4"]=>
string(4) "key4"
["key40"]=>
string(5) "key40"
["key5"]=>
string(4) "key5"
["key6"]=>
string(4) "key6"
["key7"]=>
string(4) "key7"
["key8"]=>
string(4) "key8"
["key9"]=>
string(4) "key9"
}
===DONE===
PK �c�\�ph'$ $ tests/apc_inc_perf.phptnu �[��� --TEST--
APC: apcu_inc/apcu_dec performance test (gh#164)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_store('foobar', 1);
$t = microtime(true);
var_dump(apcu_inc('foobar', 0x76543210));
var_dump(apcu_dec('foobar', 0x76543210));
var_dump(apcu_dec('foobar', -999999999));
var_dump(apcu_inc('foobar', -999999999));
$t = microtime(true) - $t;
var_dump($t < 0.1 ? true : $t);
?>
===DONE===
--EXPECT--
int(1985229329)
int(1)
int(1000000000)
int(1)
bool(true)
===DONE===
PK �c�\_�)! tests/apc_006_php73.phptnu �[��� --TEST--
APC: apcu_store/fetch reference test
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
if (PHP_VERSION_ID < 70300) die('skip Only for PHP >= 7.3');
if (PHP_VERSION_ID >= 80100) die('skip Only for PHP < 8.1');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=php
report_memleaks=0
--FILE--
<?php
$a = 'a';
$b = array($a);
$c = array('c');
$b[] = &$c;
$b[] = &$c;
$d = 'd';
$b[] = &$d;
$b[] = &$d;
$b[] = &$d;
$e = 'e';
$b[] = $e;
$b[] = $e;
$f = array('f');
$f[] = &$f;
$b[] = &$f;
apcu_store('test', $b);
$x = apcu_fetch('test');
debug_zval_dump($x);
?>
===DONE===
--EXPECTF--
array(9) refcount(2){
[0]=>
string(1) "a" %s
[1]=>
&array(1) refcount(1){
[0]=>
string(1) "c" %s
}
[2]=>
&array(1) refcount(1){
[0]=>
string(1) "c" %s
}
[3]=>
&string(1) "d" %s
[4]=>
&string(1) "d" %s
[5]=>
&string(1) "d" %s
[6]=>
string(1) "e" %s
[7]=>
string(1) "e" %s
[8]=>
&array(2) refcount(1){
[0]=>
string(1) "f" %s
[1]=>
*RECURSION*
}
}
===DONE===
PK �c�\b��? ? tests/sma001.phptnu �[��� --TEST--
Test SMA behavior #1
--INI--
apc.enabled=1
apc.enable_cli=1
apc.shm_size=16M
--FILE--
<?php
// Make sure that a sequence of alternating small and large
// allocations does not result in catastrophic fragmentation
$len = 1024 * 1024;
for ($i = 0; $i < 100; $i++) {
apcu_delete("key");
$result = apcu_store("key", str_repeat("x", $len));
if ($result === false) {
echo "Failed $i.\n";
}
// Force a small allocation
apcu_store("dummy" . $i, null);
// Increase $len slightly
$len += 100;
}
?>
===DONE===
--EXPECT--
===DONE===
PK �c�\�Zֶ� � ! tests/apc_store_string_reuse.phptnu �[��� --TEST--
The same string is used as the cache key and an array key
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=default
--FILE--
<?php
$key = 'key';
$a = [$key => null];
apcu_store($key, $a);
?>
--EXPECT--
PK �c�\�!�6 tests/apc_001.phptnu �[��� --TEST--
APC: apcu_store/fetch with strings
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$foo = 'hello world';
var_dump($foo);
apcu_store('foo',$foo);
$bar = apcu_fetch('foo');
var_dump($bar);
$bar = 'nice';
var_dump($bar);
apcu_store('foo\x00bar', $foo);
$bar = apcu_fetch('foo\x00bar');
var_dump($bar);
?>
===DONE===
--EXPECT--
string(11) "hello world"
string(11) "hello world"
string(4) "nice"
string(11) "hello world"
===DONE===
PK �c�\��U
" " tests/apc_020.phptnu �[��� --TEST--
Test default expunge logic wrt global and per-entry TTLs
--SKIPIF--
<?php
require_once(__DIR__ . '/skipif.inc');
if (!function_exists('apcu_inc_request_time')) die('skip APC debug build required');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.use_request_time=1
apc.ttl=1
apc.shm_size=1M
--FILE--
<?php
apcu_store("no_ttl_unaccessed", 12);
apcu_store("no_ttl_accessed", 24);
apcu_store("ttl", 42, 3);
apcu_store("dummy", "xxx");
apcu_inc_request_time(1);
apcu_fetch("no_ttl_accessed");
apcu_inc_request_time(1);
// Fill the cache
$i = 0;
while (apcu_exists("dummy")) {
apcu_store("key" . $i, str_repeat('x', 500));
$i++;
}
var_dump(apcu_fetch("no_ttl_unaccessed"));
var_dump(apcu_fetch("no_ttl_accessed"));
var_dump(apcu_fetch("ttl"));
?>
--EXPECT--
bool(false)
int(24)
int(42)
PK �c�\h7�=� � tests/apc_002.phptnu �[��� --TEST--
APC: apcu_store/fetch with objects
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
#[AllowDynamicProperties]
class foo { }
$foo = new foo;
var_dump($foo);
apcu_store('foo',$foo);
unset($foo);
$bar = apcu_fetch('foo');
var_dump($bar);
$bar->a = true;
var_dump($bar);
?>
===DONE===
--EXPECTF--
object(foo)#%d (0) {
}
object(foo)#%d (0) {
}
object(foo)#%d (1) {
["a"]=>
bool(true)
}
===DONE===
PK �c�\� �W W ! tests/get_included_files_inc2.incnu �[��� <?php
/* dummy include*/
include(dirname(__FILE__)."/get_included_files_inc3.inc");
?>
PK �c�\U��[v v tests/bug76145.phptnu �[��� --TEST--
Bug #76145: Data corruption reading from APCu while unserializing
--INI--
apc.enabled=1
apc.enable_cli=1
error_reporting=E_ALL&~E_DEPRECATED
--FILE--
<?php
class Session implements \Serializable
{
public $session;
public function unserialize($serialized) { $this -> session = apcu_fetch('session'); }
public function serialize() { return ''; }
}
// Create array representing a session associated with a user
// account that is enabled but has not been authenticated.
$session = ['user' => ['enabled' => True], 'authenticated' => False];
$session['user']['authenticated'] = &$session['authenticated'];
apcu_store('session', $session);
// After serializing / deserializing, session checks out as authenticated.
print unserialize(serialize(new Session())) -> session['authenticated'] === True ? 'Authenticated.' : 'Not Authenticated.';
?>
--EXPECT--
Not Authenticated.
PK �c�\zX!� � tests/iterator_011.phptnu �[��� --TEST--
APCUIterator key() and current() on invalid iterator
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_store("key1", "value1");
$it = new APCuIterator(null, APC_ITER_VALUE);
var_dump($it->key());
var_dump($it->current());
$it->next();
try {
var_dump($it->key());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump($it->current());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
string(4) "key1"
array(1) {
["value"]=>
string(6) "value1"
}
Cannot call key() on invalid iterator
Cannot call current() on invalid iterator
PK �c�\���| | tests/apc_011.phptnu �[��� --TEST--
APC: apcu_fetch resets array pointers
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$items = array('bar', 'baz');
apcu_store('test', $items);
$back = apcu_fetch('test');
var_dump(current($back));
var_dump(current($back));
?>
===DONE===
--EXPECT--
string(3) "bar"
string(3) "bar"
===DONE===
PK �c�\���9 tests/data/abc.datanu �[��� s:3:"123";
PK �c�\�=�R R tests/iterator_004.phptnu �[��� --TEST--
APC: APCIterator regex & chunk size & list
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
$it = new APCuIterator('/key[0-9]0/', APC_ITER_ALL, 1, APC_LIST_ACTIVE);
for($i = 0; $i < 41; $i++) {
apcu_store("key$i", "value$i");
}
foreach($it as $key=>$value) {
$vals[$key] = $value['key'];
}
ksort($vals);
var_dump($vals);
?>
===DONE===
--EXPECT--
array(4) {
["key10"]=>
string(5) "key10"
["key20"]=>
string(5) "key20"
["key30"]=>
string(5) "key30"
["key40"]=>
string(5) "key40"
}
===DONE===
PK �c�\�@�D D tests/ghbug247.phptnu �[��� --TEST--
GH Bug #247: when a NUL char is used as key, apcu_fetch(array) truncates the key
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_store(array("a\0b" => 'foo'));
var_dump(apcu_fetch(array("a\0b"))["a\0b"]);
?>
--EXPECT--
string(3) "foo"
PK �c�\8��F F tests/apc_008.phptnu �[��� --TEST--
APC: apcu_cas test
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
apcu_store('foobar',2);
echo "\$foobar = 2\n";
echo "\$foobar == 1 ? 2 : 1 = ".(apcu_cas('foobar', 1, 2)?"ok":"fail")."\n";
echo "\$foobar == 2 ? 1 : 2 = ".(apcu_cas('foobar', 2, 1)?"ok":"fail")."\n";
echo "\$foobar = ".apcu_fetch("foobar")."\n";
echo "\$f__bar == 1 ? 2 : 1 = ".(apcu_cas('f__bar', 1, 2)?"ok":"fail")."\n";
apcu_store('perfection', "xyz");
echo "\$perfection == 2 ? 1 : 2 = ".(apcu_cas('perfection', 2, 1)?"ok":"epic fail")."\n";
echo "\$foobar = ".apcu_fetch("foobar")."\n";
?>
===DONE===
--EXPECT--
$foobar = 2
$foobar == 1 ? 2 : 1 = fail
$foobar == 2 ? 1 : 2 = ok
$foobar = 1
$f__bar == 1 ? 2 : 1 = fail
$perfection == 2 ? 1 : 2 = epic fail
$foobar = 1
===DONE===
PK �c�\p妎G G tests/apc_024.phptnu �[��� --TEST--
Using empty string as key
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
<?php
var_dump(apcu_store("", 123));
var_dump(apcu_exists(""));
var_dump(apcu_fetch(""));
var_dump(apcu_delete(""));
?>
--EXPECT--
bool(true)
bool(true)
int(123)
bool(true)
PK �c�\�K��� � tests/apc_014_store_ref.phptnu �[��� --TEST--
APC: store array of references
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.serializer=php
--FILE--
<?php
$_items = [
'key1' => 'value1',
'key2' => 'value2',
];
$items = [];
foreach($_items as $k => $v) {
$items["prefix_$k"] = &$v;
}
var_dump(apcu_store($items));
?>
===DONE===
--EXPECT--
array(0) {
}
===DONE===
PK �c�\����{ { tests/apc_005.phptnu �[��� PK �c�\U��i � tests/apc_006_php81.phptnu �[��� PK �c�\��~9 tests/iterator_008.phptnu �[��� PK �c�\ڨ{-~ ~ # O
tests/apc_store_array_int_keys.phptnu �[��� PK �c�\9 \� � tests/apc_099.phptnu �[��� PK �c�\���/w w �
tests/iterator_007.phptnu �[��� PK �c�\zP�� � � tests/apc_006.phptnu �[��� PK �c�\T��>� � q tests/apc_015.phptnu �[��� PK �c�\�[�� � � tests/apc_003b_legacy.phptnu �[��� PK �c�\�
� � tests/apc_entry_003.phptnu �[��� PK �c�\�i
� � "