[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] cvs: pecl /memcache memcache.c php_memcache.h /memcache/tests 002.phpt 003.phpt 010.phpt
From: "Mikael Johansson" <mikl () php ! net>
Date: 2005-11-28 22:03:36
Message-ID: cvsmikl1133215416 () cvsserver
[Download RAW message or body]
mikl Mon Nov 28 17:03:36 2005 EDT
Modified files:
/pecl/memcache memcache.c php_memcache.h
/pecl/memcache/tests 002.phpt 003.phpt 010.phpt 011.phpt 017.phpt
connect.inc
Log:
_mmc_open() used "err" uninitialized under PHP4
memcache_add_server() parses a "zend_bool persistent"
mmc_read_value() with empty response caused dangling pointer
Added regexp to some unit tests for the sake of PHP4 compat
["mikl-20051128170336.txt" (text/plain)]
http://cvs.php.net/diff.php/pecl/memcache/memcache.c?r1=1.32&r2=1.33&ty=u
Index: pecl/memcache/memcache.c
diff -u pecl/memcache/memcache.c:1.32 pecl/memcache/memcache.c:1.33
--- pecl/memcache/memcache.c:1.32 Sat Nov 26 15:39:02 2005
+++ pecl/memcache/memcache.c Mon Nov 28 17:03:32 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: memcache.c,v 1.32 2005/11/26 20:39:02 tony2001 Exp $ */
+/* $Id: memcache.c,v 1.33 2005/11/28 22:03:32 mikl Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -108,7 +108,7 @@
PHP_RSHUTDOWN(memcache), /* Replace with NULL if there's nothing to do at request \
end */ PHP_MINFO(memcache),
#if ZEND_MODULE_API_NO >= 20010901
- "1.3", /* Replace with version number for your extension */
+ "1.7", /* Replace with version number for your extension */
#endif
STANDARD_MODULE_PROPERTIES
};
@@ -246,7 +246,7 @@
php_info_print_table_start();
php_info_print_table_header(2, "memcache support", "enabled");
php_info_print_table_row(2, "Active persistent connections", buf);
- php_info_print_table_row(2, "Revision", "$Revision: 1.32 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.33 $");
php_info_print_table_end();
}
/* }}} */
@@ -320,10 +320,6 @@
static void mmc_server_free(mmc_t *mmc TSRMLS_DC) /* {{{ */
{
if (mmc->persistent) {
- if (mmc->stream != NULL) {
- /* persistent streams are closed by the engine */
- /* php_stream_pclose(mmc->stream); */
- }
free(mmc->host);
free(mmc);
MEMCACHE_G(num_persistent)--;
@@ -491,7 +487,7 @@
{
struct timeval tv;
char *hostname = NULL, *hash_key = NULL, *errstr = NULL;
- int hostname_len, err;
+ int hostname_len, err = 0;
/* close open stream */
if (mmc->stream != NULL) {
@@ -1035,8 +1031,10 @@
for (i=0; i<data_len+2; i+=size) {
if ((size = php_stream_read(mmc->stream, data + i, data_len + 2 - i)) == 0) {
MMC_DEBUG(("incomplete data block (expected %d, got %d)", (data_len + 2), i));
+ if (key) {
+ efree(*key);
+ }
efree(data);
- if (key) efree(*key);
return -1;
}
}
@@ -1048,7 +1046,6 @@
}
ZVAL_EMPTY_STRING(*value);
efree(data);
- if (key) efree(*key);
return 1;
}
@@ -1058,8 +1055,10 @@
if (!mmc_uncompress(&result_data, &result_len, data, data_len)) {
MMC_DEBUG(("Error when uncompressing data"));
+ if (key) {
+ efree(*key);
+ }
efree(data);
- if (key) efree(*key);
return -1;
}
@@ -1082,8 +1081,10 @@
if (!php_var_unserialize(value, (const unsigned char **)&tmp, tmp + data_len, \
&var_hash TSRMLS_CC)) { MMC_DEBUG(("Error at offset %d of %d bytes", tmp - data, \
data_len)); PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ if (key) {
+ efree(*key);
+ }
efree(data);
- if (key) efree(*key);
return -1;
}
@@ -1507,24 +1508,25 @@
}
/* }}} */
-/* {{{ proto bool memcache_add_server( string host [, int port [ bool persistent [, \
unsigned int weight [, int timeout [, int retry_interval ] ] ] ] ]) +/* {{{ proto \
bool memcache_add_server( string host [, int port [, bool persistent [, int weight [, \
int timeout [, int retry_interval ] ] ] ] ]) Adds a connection to the pool. The \
order in which this function is called is significant */ \
PHP_FUNCTION(memcache_add_server) {
zval **connection, *mmc_object = getThis();
mmc_pool_t *pool;
mmc_t *mmc;
- long port = MEMCACHE_G(default_port), persistent = 1, weight = 1, timeout = \
MMC_DEFAULT_TIMEOUT, retry_interval = MMC_DEFAULT_RETRY; + long port = \
MEMCACHE_G(default_port), weight = 1, timeout = MMC_DEFAULT_TIMEOUT, retry_interval = \
MMC_DEFAULT_RETRY; + zend_bool persistent = 1;
int resource_type, host_len;
char *host;
if (mmc_object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lllll", &host, &host_len, \
&port, &persistent, &weight, &timeout, &retry_interval) == FAILURE) { + if \
(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lblll", &host, &host_len, &port, \
&persistent, &weight, &timeout, &retry_interval) == FAILURE) { return;
}
}
else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os|lllll", &mmc_object, \
memcache_class_entry_ptr, &host, &host_len, &port, &persistent, &weight, &timeout, \
&retry_interval) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() \
TSRMLS_CC, "Os|lblll", &mmc_object, memcache_class_entry_ptr, &host, &host_len, \
&port, &persistent, &weight, &timeout, &retry_interval) == FAILURE) { return;
}
}
@@ -1661,7 +1663,7 @@
}
/* }}} */
-/* {{{ proto bool memcache_add( object memcache, string key, mixed var [, int expire \
] ) +/* {{{ proto bool memcache_add( object memcache, string key, mixed var [, int \
flag [, int expire ] ] ) Adds new item. Item with such key should not exist. */
PHP_FUNCTION(memcache_add)
{
@@ -1669,7 +1671,7 @@
}
/* }}} */
-/* {{{ proto bool memcache_set( object memcache, string key, mixed var [, int expire \
] ) +/* {{{ proto bool memcache_set( object memcache, string key, mixed var [, int \
flag [, int expire ] ] ) Sets the value of an item. Item may exist or not */
PHP_FUNCTION(memcache_set)
{
@@ -1677,7 +1679,7 @@
}
/* }}} */
-/* {{{ proto bool memcache_replace( object memcache, string key, mixed var [, int \
expire ] ) +/* {{{ proto bool memcache_replace( object memcache, string key, mixed \
var [, int flag [, int expire ] ] ) Replaces existing item. Returns false if item \
doesn't exist */ PHP_FUNCTION(memcache_replace)
{
@@ -1720,7 +1722,7 @@
}
/* }}} */
-/* {{{ proto bool memcache_delete( object memcache, string key, [ int expire ])
+/* {{{ proto bool memcache_delete( object memcache, string key [, int expire ])
Deletes existing item */
PHP_FUNCTION(memcache_delete)
{
@@ -1857,7 +1859,7 @@
}
/* }}} */
-/* {{{ proto array memcache_set_compress_threshold( object memcache, int threshold[ \
, float min_savings ] ) +/* {{{ proto array memcache_set_compress_threshold( object \
memcache, int threshold [, float min_savings ] ) Set automatic compress threshold */
PHP_FUNCTION(memcache_set_compress_threshold)
{
http://cvs.php.net/diff.php/pecl/memcache/php_memcache.h?r1=1.9&r2=1.10&ty=u
Index: pecl/memcache/php_memcache.h
diff -u pecl/memcache/php_memcache.h:1.9 pecl/memcache/php_memcache.h:1.10
--- pecl/memcache/php_memcache.h:1.9 Sat Oct 29 10:24:49 2005
+++ pecl/memcache/php_memcache.h Mon Nov 28 17:03:33 2005
@@ -12,11 +12,12 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Antony Dovgal <tony2001@phpclub.net> |
+ | Authors: Antony Dovgal <tony2001@phpclub.net> |
+ | Mikael Johansson <mikael AT synd DOT info> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_memcache.h,v 1.9 2005/10/29 14:24:49 mikl Exp $ */
+/* $Id: php_memcache.h,v 1.10 2005/11/28 22:03:33 mikl Exp $ */
#ifndef PHP_MEMCACHE_H
#define PHP_MEMCACHE_H
http://cvs.php.net/diff.php/pecl/memcache/tests/002.phpt?r1=1.2&r2=1.3&ty=u
Index: pecl/memcache/tests/002.phpt
diff -u pecl/memcache/tests/002.phpt:1.2 pecl/memcache/tests/002.phpt:1.3
--- pecl/memcache/tests/002.phpt:1.2 Fri Nov 5 02:16:14 2004
+++ pecl/memcache/tests/002.phpt Mon Nov 28 17:03:35 2005
@@ -24,7 +24,7 @@
?>
--EXPECTF--
-object(stdClass)#%d (2) {
+object(stdClass)%s2) {
["plain_attribute"]=>
string(5) "value"
["array_attribute"]=>
@@ -37,7 +37,7 @@
}
array(2) {
["test_key"]=>
- object(stdClass)#%d (2) {
+ object(stdClass)%s2) {
["plain_attribute"]=>
string(5) "value"
["array_attribute"]=>
@@ -49,7 +49,7 @@
}
}
["test_key1"]=>
- object(stdClass)#%d (2) {
+ object(stdClass)%s2) {
["plain_attribute"]=>
string(5) "value"
["array_attribute"]=>
http://cvs.php.net/diff.php/pecl/memcache/tests/003.phpt?r1=1.2&r2=1.3&ty=u
Index: pecl/memcache/tests/003.phpt
diff -u pecl/memcache/tests/003.phpt:1.2 pecl/memcache/tests/003.phpt:1.3
--- pecl/memcache/tests/003.phpt:1.2 Fri Nov 5 02:16:14 2004
+++ pecl/memcache/tests/003.phpt Mon Nov 28 17:03:35 2005
@@ -24,7 +24,7 @@
?>
--EXPECTF--
-object(stdClass)#%d (2) {
+object(stdClass)%s2) {
["plain_attribute"]=>
string(5) "value"
["array_attribute"]=>
@@ -37,7 +37,7 @@
}
array(2) {
["test_key"]=>
- object(stdClass)#%d (2) {
+ object(stdClass)%s2) {
["plain_attribute"]=>
string(5) "value"
["array_attribute"]=>
@@ -49,7 +49,7 @@
}
}
["test_key1"]=>
- object(stdClass)#%d (2) {
+ object(stdClass)%s2) {
["plain_attribute"]=>
string(5) "value"
["array_attribute"]=>
http://cvs.php.net/diff.php/pecl/memcache/tests/010.phpt?r1=1.2&r2=1.3&ty=u
Index: pecl/memcache/tests/010.phpt
diff -u pecl/memcache/tests/010.phpt:1.2 pecl/memcache/tests/010.phpt:1.3
--- pecl/memcache/tests/010.phpt:1.2 Sat Nov 26 15:39:25 2005
+++ pecl/memcache/tests/010.phpt Mon Nov 28 17:03:35 2005
@@ -19,7 +19,7 @@
?>
--EXPECTF--
-object(stdClass)#%d (2) {
+object(stdClass)%s2) {
["plain_attribute"]=>
string(5) "value"
["array_attribute"]=>
http://cvs.php.net/diff.php/pecl/memcache/tests/011.phpt?r1=1.1&r2=1.2&ty=u
Index: pecl/memcache/tests/011.phpt
diff -u pecl/memcache/tests/011.phpt:1.1 pecl/memcache/tests/011.phpt:1.2
--- pecl/memcache/tests/011.phpt:1.1 Wed Mar 17 04:34:55 2004
+++ pecl/memcache/tests/011.phpt Mon Nov 28 17:03:35 2005
@@ -19,7 +19,7 @@
?>
--EXPECTF--
-object(stdClass)#%d (2) {
+object(stdClass)%s2) {
["plain_attribute"]=>
string(5) "value"
["array_attribute"]=>
http://cvs.php.net/diff.php/pecl/memcache/tests/017.phpt?r1=1.1&r2=1.2&ty=u
Index: pecl/memcache/tests/017.phpt
diff -u pecl/memcache/tests/017.phpt:1.1 pecl/memcache/tests/017.phpt:1.2
--- pecl/memcache/tests/017.phpt:1.1 Fri Aug 5 07:45:15 2005
+++ pecl/memcache/tests/017.phpt Mon Nov 28 17:03:35 2005
@@ -3,13 +3,13 @@
--FILE--
<?php
-class Test extends Memcache {
+class test extends Memcache {
function foo() {
echo "foo\n";
}
}
-$t = new Test;
+$t = new test;
$t->connect("localhost");
$t->foo();
@@ -19,7 +19,7 @@
?>
--EXPECTF--
foo
-object(Test)#%d (1) {
+object(test)(1) {
["connection"]=>
resource(%d) of type (memcache connection)
}
http://cvs.php.net/diff.php/pecl/memcache/tests/connect.inc?r1=1.2&r2=1.3&ty=u
Index: pecl/memcache/tests/connect.inc
diff -u pecl/memcache/tests/connect.inc:1.2 pecl/memcache/tests/connect.inc:1.3
--- pecl/memcache/tests/connect.inc:1.2 Sat Oct 29 10:24:50 2005
+++ pecl/memcache/tests/connect.inc Mon Nov 28 17:03:35 2005
@@ -8,8 +8,8 @@
$port = 11211;
// Start an extra server and uncomment to enable load-balancing and failover tests
-//$host2 = "localhost";
-//$port2 = 11212;
+$host2 = "localhost";
+$port2 = 11212;
$nonExistingHost = "localhost";
$nonExistingPort = 11213;
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic