package.xml 0000664 0001750 0001750 00000007674 12657127073 011677 0 ustar remi remi
apcu_bc
pecl.php.net
APCu Backwards Compatibility Module
This module provides a backwards APC compatible API using APCu.
Joe Watkins
krakjoe
krakjoe@php.net
yes
Remi Collet
remi
remi@php.net
yes
2016-02-11
1.0.3
5.1
beta
stable
PHP License
- fix gh#14: apc_inc segfaults if APCu is disabled
- fix Windows build
7.0.0
1.10
apcu
pecl.php.net
5.1.2
apcu
apc
2015-12-07
1.0.0
5.1
beta
stable
PHP License
- initial release
2016-01-06
1.0.1
5.1
beta
stable
PHP License
- fix gh#10 - apc_clear_cache: parameter is optional
- apc_cache_info: both parameters are optional
- add dep on APCu extension
2016-01-29
1.0.2
5.1
beta
stable
PHP License
- restore apc behavior, apc_inc / apc_dec fail when key doesnt exists
apcu_bc-1.0.3/tests/apc_001.phpt 0000664 0001750 0001750 00000001063 12657127073 014757 0 ustar remi remi --TEST--
APC compat: apc_store/fetch with strings
--SKIPIF--
--INI--
apc.enabled=1
apc.enable_cli=1
apc.file_update_protection=0
--FILE--
===DONE===
--EXPECTF--
string(11) "hello world"
string(11) "hello world"
string(4) "nice"
string(11) "hello world"
===DONE===
apcu_bc-1.0.3/tests/apc_cache_info.phpt 0000664 0001750 0001750 00000001453 12657127073 016540 0 ustar remi remi --TEST--
APC compat: apc_clear_cache
--SKIPIF--
--INI--
apc.enabled=1
apc.enable_cli=1
apc.file_update_protection=0
--FILE--
===DONE===
--EXPECTF--
NULL
array(10) {
["num_slots"]=>
int(%d)
["ttl"]=>
int(%d)
["num_hits"]=>
float(3)
["num_misses"]=>
float(2)
["num_inserts"]=>
float(1)
["num_entries"]=>
int(1)
["expunges"]=>
float(0)
["start_time"]=>
int(%d)
["mem_size"]=>
float(%d)
["memory_type"]=>
string(%d) "%s"
}
===DONE===
apcu_bc-1.0.3/tests/apc_clear_cache.phpt 0000664 0001750 0001750 00000001027 12657127073 016670 0 ustar remi remi --TEST--
APC compat: apc_clear_cache
--SKIPIF--
--INI--
apc.enabled=1
apc.enable_cli=1
apc.file_update_protection=0
--FILE--
===DONE===
--EXPECTF--
string(11) "hello world"
string(11) "hello world"
bool(false)
===DONE===
apcu_bc-1.0.3/tests/apc_incdec.phpt 0000664 0001750 0001750 00000001473 12657127073 015711 0 ustar remi remi --TEST--
APC compat: apc_inc / apc_dec
--SKIPIF--
--INI--
apc.enabled=1
apc.enable_cli=1
apc.file_update_protection=0
--FILE--
===DONE===
--EXPECTF--
* Key not set
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
* Set the key
bool(true)
* Key set
int(101)
int(103)
bool(true)
int(102)
int(99)
bool(true)
===DONE===
apcu_bc-1.0.3/tests/apc_inc_gh14.phpt 0000664 0001750 0001750 00000000401 12657127073 016046 0 ustar remi remi --TEST--
APC compat: apc_inc segfaults if APCU is disabled
--SKIPIF--
--INI--
apc.enabled=0
apc.enable_cli=0
--FILE--
===DONE===
--EXPECTF--
bool(false)
===DONE===
apcu_bc-1.0.3/tests/iterator_005_bc.phpt 0000664 0001750 0001750 00000003506 12657127073 016521 0 ustar remi remi --TEST--
APC compat: APCIterator delete
--SKIPIF--
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
$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===
apcu_bc-1.0.3/tests/iterator_008_bc.phpt 0000664 0001750 0001750 00000003412 12657127073 016520 0 ustar remi remi --TEST--
APC compat: APCIterator general
--SKIPIF--
--INI--
apc.enabled=1
apc.enable_cli=1
--FILE--
$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===
apcu_bc-1.0.3/tests/skipif.inc 0000664 0001750 0001750 00000000115 12657127073 014714 0 ustar remi remi
apcu_bc-1.0.3/config.m4 0000664 0001750 0001750 00000000467 12657127073 013313 0 ustar remi remi dnl $Id$
dnl config.m4 for apcu-bc extension
PHP_ARG_ENABLE(apc, whether to enable APCu BC support,
[ --enable-apc Enable APCu BC support])
if test "$PHP_APC" != "no"; then
PHP_NEW_EXTENSION(apc, php_apc.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_EXTENSION_DEP(apc, apcu)
fi
apcu_bc-1.0.3/config.w32 0000664 0001750 0001750 00000000373 12657127073 013402 0 ustar remi remi // $Id$
// vim:ft=javascript
ARG_ENABLE("apc", "enable APCu BC support", "no");
if (PHP_APC != "no") {
EXTENSION("apc", "php_apc.c", PHP_APC_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_EXTENSION_DEP("apc", "apcu", true);
}
apcu_bc-1.0.3/php_apc.h 0000664 0001750 0001750 00000003135 12657127073 013362 0 ustar remi remi /*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2015-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: krakjoe |
+----------------------------------------------------------------------+
*/
#ifndef PHP_APC_H
#define PHP_APC_H
#define PHP_APC_EXTNAME "apc"
#define PHP_APCU_BC_VERSION "1.0.3"
#define PHP_APC_VERSION PHP_APCU_BC_VERSION
extern zend_module_entry apc_module_entry;
#define apc_module_ptr &apc_module_entry
#define phpext_apc_ptr apc_module_ptr
#if defined(ZTS) && defined(COMPILE_DL_APC)
ZEND_TSRMLS_CACHE_EXTERN();
#endif
#endif /* PHP_APC_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
* vim<600: expandtab sw=4 ts=4 sts=4
*/
apcu_bc-1.0.3/php_apc.c 0000664 0001750 0001750 00000017604 12657127073 013363 0 ustar remi remi /*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2015-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: krakjoe |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "php.h"
#include "zend.h"
#include "zend_API.h"
#include "zend_compile.h"
#include "zend_hash.h"
#include "zend_extensions.h"
#include "zend_interfaces.h"
#include "SAPI.h"
#include "php_apc.h"
#include "ext/standard/info.h"
#include "ext/apcu/php_apc.h"
#include "ext/apcu/apc_arginfo.h"
#include "ext/apcu/apc_iterator.h"
#ifdef HAVE_SYS_FILE_H
#include
#endif
zend_class_entry *apc_bc_iterator_ce;
zend_object_handlers apc_bc_iterator_handlers;
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(arginfo_apcu_bc_cache_info, 0, 0, 0)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, limited)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_apcu_bc_clear_cache, 0, 0, 0)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()
/* }}} */
/* {{{ PHP_FUNCTION declarations */
PHP_FUNCTION(apc_cache_info);
PHP_FUNCTION(apc_clear_cache);
/* }}} */
/* {{{ PHP_MINFO_FUNCTION(apc) */
static PHP_MINFO_FUNCTION(apc)
{
php_info_print_table_start();
php_info_print_table_row(2, "APC Compatibility", PHP_APCU_BC_VERSION);
php_info_print_table_row(2, "APCu Version", PHP_APCU_VERSION);
php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__);
php_info_print_table_end();
}
/* }}} */
static int apc_bc_iterator_init(int module_number);
/* {{{ PHP_RINIT_FUNCTION(apc) */
static PHP_RINIT_FUNCTION(apc)
{
#if defined(ZTS) && defined(COMPILE_DL_APC)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
/* }}} */
/* {{{ proto void apc_clear_cache(string cache) */
PHP_FUNCTION(apc_clear_cache) {
zend_string *name = NULL;
zval proxy;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &name) != SUCCESS) {
return;
}
if (name && !strcasecmp(ZSTR_VAL(name), "user")) {
ZVAL_STR(&proxy,
zend_string_init(ZEND_STRL("apcu_clear_cache"), 0));
call_user_function(EG(function_table), NULL, &proxy, return_value, 0, NULL);
zval_ptr_dtor(&proxy);
}
}
/* }}} */
/* {{{ proto array apc_cache_info(string cache [, bool limited = false]) */
PHP_FUNCTION(apc_cache_info) {
zend_string *name = NULL;
zval param, *limited = ¶m, proxy;
ZVAL_FALSE(¶m);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|Sz", &name, &limited) != SUCCESS) {
return;
}
if (name && !strcasecmp(ZSTR_VAL(name), "user")) {
ZVAL_STR(&proxy,
zend_string_init(ZEND_STRL("apcu_cache_info"), 0));
call_user_function(EG(function_table), NULL, &proxy, return_value, 1, limited);
zval_ptr_dtor(&proxy);
}
}
/* }}} */
static void php_apcu_bc_inc_dec(INTERNAL_FUNCTION_PARAMETERS, zend_string *funcname) /* {{{ */
{
zend_string *key;
zend_long step = 1;
zval proxy, params[3], *success = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|lz", &key, &step, &success) == FAILURE) {
return;
}
/* Check if key exists to keep old APC behavior */
ZVAL_STR(&proxy, zend_string_init(ZEND_STRL("apcu_exists"), 0));
ZVAL_STR(¶ms[0], key);
call_user_function(EG(function_table), NULL, &proxy, return_value, 1, params);
if (Z_TYPE_INFO_P(return_value) != IS_TRUE) {
if (success) {
ZVAL_DEREF(success);
zval_ptr_dtor(success);
ZVAL_FALSE(success);
}
RETURN_FALSE;
}
/* inc/dec the key */
ZVAL_STR(&proxy, funcname);
ZVAL_STR(¶ms[0], key);
ZVAL_LONG(¶ms[1], step);
if (success) {
ZVAL_COPY_VALUE(¶ms[2], success);
}
call_user_function(EG(function_table), NULL, &proxy, return_value, (success ? 3 : 2), params);
}
/* }}} */
/* {{{ proto long apc_inc(string key [, long step [, bool& success]])
*/
PHP_FUNCTION(apc_inc) {
php_apcu_bc_inc_dec(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_string_init(ZEND_STRL("apcu_inc"), 0));
}
/* }}} */
/* {{{ proto long apc_dec(string key [, long step [, bool &success]])
*/
PHP_FUNCTION(apc_dec) {
php_apcu_bc_inc_dec(INTERNAL_FUNCTION_PARAM_PASSTHRU, zend_string_init(ZEND_STRL("apcu_dec"), 0));
}
/* }}} */
/* {{{ apc_functions[] */
zend_function_entry apc_functions[] = {
PHP_FE(apc_cache_info, arginfo_apcu_bc_cache_info)
PHP_FE(apc_clear_cache, arginfo_apcu_bc_clear_cache)
PHP_FALIAS(apc_store, apcu_store, arginfo_apcu_store)
PHP_FALIAS(apc_fetch, apcu_fetch, arginfo_apcu_fetch)
PHP_FALIAS(apc_enabled, apcu_enabled, arginfo_apcu_enabled)
PHP_FALIAS(apc_delete, apcu_delete, arginfo_apcu_delete)
PHP_FALIAS(apc_add, apcu_add, arginfo_apcu_store)
PHP_FALIAS(apc_sma_info, apcu_sma_info, arginfo_apcu_sma_info)
PHP_FE(apc_inc, arginfo_apcu_inc)
PHP_FE(apc_dec, arginfo_apcu_inc)
PHP_FALIAS(apc_cas, apcu_cas, arginfo_apcu_cas)
PHP_FALIAS(apc_exists, apcu_exists, arginfo_apcu_exists)
PHP_FE_END
};
/* }}} */
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(arginfo_apc_iterator___construct, 0, 0, 1)
ZEND_ARG_INFO(0, ignored)
ZEND_ARG_INFO(0, search)
ZEND_ARG_INFO(0, format)
ZEND_ARG_INFO(0, chunk_size)
ZEND_ARG_INFO(0, list)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_apc_iterator_void, 0, 0, 0)
ZEND_END_ARG_INFO()
/* }}} */
/* {{{ proto object APCIterator::__construct(cache, [ mixed search [, long format [, long chunk_size [, long list ]]]]) */
PHP_METHOD(apc_bc_iterator, __construct) {
apc_iterator_t *iterator = apc_iterator_fetch(getThis());
zend_long format = APC_ITER_ALL;
zend_long chunk_size=0;
zval *search = NULL;
zend_long list = APC_LIST_ACTIVE;
zend_string *cache;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zlll", &cache, &search, &format, &chunk_size, &list) == FAILURE) {
return;
}
if (apc_is_enabled()) {
apc_iterator_obj_init(iterator, search, format, chunk_size, list);
}
}
/* }}} */
/* {{{ apc_iterator_functions */
static zend_function_entry apc_iterator_functions[] = {
PHP_ME(apc_bc_iterator, __construct, arginfo_apc_iterator___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_FE_END
};
/* }}} */
/* {{{ apc_bc_iterator_init */
static int apc_bc_iterator_init(int module_number) {
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "APCIterator", apc_iterator_functions);
apc_bc_iterator_ce = zend_register_internal_class_ex(&ce, apc_iterator_get_ce());
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINIT_FUNCTION(apc) */
static PHP_MINIT_FUNCTION(apc)
{
if (apc_iterator_get_ce()) {
apc_bc_iterator_init(module_number);
}
return SUCCESS;
}
static const zend_module_dep apc_deps[] = {
ZEND_MOD_REQUIRED("apcu")
ZEND_MOD_END
};
/* {{{ module definition structure */
zend_module_entry apc_module_entry = {
STANDARD_MODULE_HEADER_EX,
NULL,
apc_deps,
PHP_APC_EXTNAME,
apc_functions,
PHP_MINIT(apc),
NULL,
PHP_RINIT(apc),
NULL,
PHP_MINFO(apc),
PHP_APCU_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_APC
ZEND_GET_MODULE(apc)
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
#endif
#endif
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
* vim<600: expandtab sw=4 ts=4 sts=4
*/
apcu_bc-1.0.3/README.md 0000664 0001750 0001750 00000000433 12657127073 013054 0 ustar remi remi APCu Backwards Compatibility Module
===============================
[](https://travis-ci.org/krakjoe/apcu-bc)
This module provides a backwards APC compatible API using [APCu](https://github.com/krakjoe/apcu).
apcu_bc-1.0.3/LICENSE 0000664 0001750 0001750 00000006222 12657127073 012604 0 ustar remi remi --------------------------------------------------------------------
The PHP License, version 3.01
Copyright (c) 1999 - 2014 The PHP Group. All rights reserved.
--------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, is permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name "PHP" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact group@php.net.
4. Products derived from this software may not be called "PHP", nor
may "PHP" appear in their name, without prior written permission
from group@php.net. You may indicate that your software works in
conjunction with PHP by saying "Foo for PHP" instead of calling
it "PHP Foo" or "phpfoo"
5. The PHP Group may publish revised and/or new versions of the
license from time to time. Each version will be given a
distinguishing version number.
Once covered code has been published under a particular version
of the license, you may always continue to use it under the terms
of that version. You may also choose to use such covered code
under the terms of any subsequent version of the license
published by the PHP Group. No one other than the PHP Group has
the right to modify the terms applicable to covered code created
under this License.
6. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes PHP software, freely available from
".
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------
This software consists of voluntary contributions made by many
individuals on behalf of the PHP Group.
The PHP Group can be contacted via Email at group@php.net.
For more information on the PHP Group and the PHP project,
please see .
PHP includes the Zend Engine, freely available at
.