Index: /branches/1.3/ChangeLog
===================================================================
--- /branches/1.3/ChangeLog	(revision 601)
+++ /branches/1.3/ChangeLog	(revision 602)
@@ -1,2 +1,7 @@
+1.3.0 2009-??-??
+== ChangeLog ==
+ * could not show module info in admin page when XCache is the last module
+ * wrong http auth realm
+
 1.2.2 2007-12-29
 == ChangeLog ==
Index: /branches/1.3/NEWS
===================================================================
--- /branches/1.3/NEWS	(revision 601)
+++ /branches/1.3/NEWS	(revision 602)
@@ -1,2 +1,5 @@
+1.3.0 2009-??-??
+========
+ 
 1.2.2 2007-12-29
 ========
Index: /branches/1.3/admin/xcache.php
===================================================================
--- /branches/1.3/admin/xcache.php	(revision 601)
+++ /branches/1.3/admin/xcache.php	(revision 602)
@@ -207,5 +207,5 @@
 	phpinfo(INFO_MODULES);
 	$moduleinfo = ob_get_clean();
-	if (preg_match('!XCache</a></h2>(.*?)<h2><a name="module_!is', $moduleinfo, $m)) {
+	if (preg_match('!XCache</a></h2>(.*?)<h2>!is', $moduleinfo, $m)) {
 		$moduleinfo = $m[1];
 	}
Index: /branches/1.3/xc_malloc.c
===================================================================
--- /branches/1.3/xc_malloc.c	(revision 601)
+++ /branches/1.3/xc_malloc.c	(revision 602)
@@ -20,13 +20,43 @@
 };
 
+/* {{{ _xc_malloc_shm_t */
+struct _xc_malloc_shm_t {
+	xc_shm_handlers_t *handlers;
+	xc_shmsize_t       size;
+	xc_shmsize_t       memoffset;
+#ifdef HAVE_XCACHE_TEST
+	HashTable blocks;
+#endif
+};
+/* }}} */
+
 #define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0)
 
+static void *xc_add_to_blocks(xc_mem_t *mem, void *p, size_t size) /* {{{ */
+{
+#ifdef HAVE_XCACHE_TEST
+	if (p) {
+		zend_hash_add(&mem->shm->blocks, (void *) &p, sizeof(p), (void *) &size, sizeof(size), NULL);
+	}
+#endif
+	return p;
+}
+/* }}} */
+static void xc_del_from_blocks(xc_mem_t *mem, void *p) /* {{{ */
+{
+#ifdef HAVE_XCACHE_TEST
+	zend_hash_del(&mem->shm->blocks, (void *) &p, sizeof(p));
+#endif
+}
+/* }}} */
+
 static XC_MEM_MALLOC(xc_malloc_malloc) /* {{{ */
 {
-	return malloc(size);
+	return xc_add_to_blocks(mem, malloc(size), size);
 }
 /* }}} */
 static XC_MEM_FREE(xc_malloc_free) /* {{{ return block size freed */
 {
+	xc_del_from_blocks(mem, (void *) p);
 	free((void *) p);
 	return 0;
@@ -35,15 +65,15 @@
 static XC_MEM_CALLOC(xc_malloc_calloc) /* {{{ */
 {
-	return calloc(memb, size);
+	return xc_add_to_blocks(mem, calloc(memb, size), size);
 }
 /* }}} */
 static XC_MEM_REALLOC(xc_malloc_realloc) /* {{{ */
 {
-	return realloc((void *) p, size);
+	return xc_add_to_blocks(mem, realloc((void *) p, size), size);
 }
 /* }}} */
 static XC_MEM_STRNDUP(xc_malloc_strndup) /* {{{ */
 {
-	char *p = malloc(len);
+	char *p = xc_add_to_blocks(mem, malloc(len), len);
 	if (!p) {
 		return NULL;
@@ -111,12 +141,4 @@
 /* }}} */
 
-/* {{{ _xc_malloc_shm_t */
-struct _xc_malloc_shm_t {
-	xc_shm_handlers_t *handlers;
-	xc_shmsize_t       size;
-	xc_shmsize_t       memoffset;
-};
-/* }}} */
-
 static XC_SHM_CAN_READONLY(xc_malloc_can_readonly) /* {{{ */
 {
@@ -126,4 +148,17 @@
 static XC_SHM_IS_READWRITE(xc_malloc_is_readwrite) /* {{{ */
 {
+	HashPosition pos;
+	size_t *psize;
+	char **ptr;
+
+	zend_hash_internal_pointer_reset_ex(&shm->blocks, &pos);
+	while (zend_hash_get_current_data_ex(&shm->blocks, (void **) &psize, &pos) == SUCCESS) {
+		zend_hash_get_current_key_ex(&shm->blocks, (void *) &ptr, NULL, NULL, 0, &pos);
+		if ((char *) p >= *ptr && (char *) p < *ptr + *psize) {
+			return 1;
+		}
+		zend_hash_move_forward_ex(&shm->blocks, &pos);
+	}
+
 	return 0;
 }
@@ -147,4 +182,7 @@
 static XC_SHM_DESTROY(xc_malloc_destroy) /* {{{ */
 {
+#ifdef HAVE_XCACHE_TEST
+	zend_hash_destroy(&shm->blocks);
+#endif
 	free(shm);
 	return;
@@ -157,4 +195,7 @@
 	shm->size = size;
 
+#ifdef HAVE_XCACHE_TEST
+	zend_hash_init(&shm->blocks, 64, NULL, NULL, 1);
+#endif
 	return shm;
 err:
Index: /branches/1.3/xcache.c
===================================================================
--- /branches/1.3/xcache.c	(revision 601)
+++ /branches/1.3/xcache.c	(revision 602)
@@ -392,5 +392,11 @@
 	xc_mem_t *mem = cache->mem;
 	const xc_mem_handlers_t *handlers = mem->handlers;
-	zend_ulong interval = (cachetype == XC_TYPE_PHP) ? xc_php_gc_interval : xc_var_gc_interval;
+	zend_ulong interval;
+	if (cachetype == XC_TYPE_PHP) {
+		interval = xc_php_ttl ? xc_php_gc_interval : 0;
+	}
+	else {
+		interval = xc_var_gc_interval;
+	}
 
 	add_assoc_long_ex(return_value, ZEND_STRS("slots"),     cache->hentry->size);
@@ -405,5 +411,6 @@
 	add_assoc_long_ex(return_value, ZEND_STRS("deleted"),   cache->deletes_count);
 	if (interval) {
-		add_assoc_long_ex(return_value, ZEND_STRS("gc"),    (cache->last_gc_expires + interval) - XG(request_time));
+		time_t gc = (cache->last_gc_expires + interval) - XG(request_time);
+		add_assoc_long_ex(return_value, ZEND_STRS("gc"),    gc > 0 ? gc : 0);
 	}
 	else {
@@ -1624,5 +1631,5 @@
 	}
 
-#define STR "WWW-authenticate: basic realm='XCache Administration'"
+#define STR "WWW-authenticate: Basic Realm=\"XCache Administration\""
 	sapi_add_header_ex(STR, sizeof(STR) - 1, 1, 1 TSRMLS_CC);
 #undef STR
@@ -2453,12 +2460,12 @@
 static void xc_zend_extension_register(zend_extension *new_extension, DL_HANDLE handle)
 {
-    zend_extension extension;
-
-    extension = *new_extension;
-    extension.handle = handle;
-
-    zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
-
-    zend_llist_prepend_element(&zend_extensions, &extension);
+	zend_extension extension;
+
+	extension = *new_extension;
+	extension.handle = handle;
+
+	zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
+
+	zend_llist_prepend_element(&zend_extensions, &extension);
 	TRACE("%s", "registered");
 }
@@ -2513,9 +2520,9 @@
 static int xc_zend_extension_startup(zend_extension *extension)
 {
-    if (extension->startup) {
-        if (extension->startup(extension) != SUCCESS) {
+	if (extension->startup) {
+		if (extension->startup(extension) != SUCCESS) {
 			return FAILURE;
-        }
-    }
+		}
+	}
 	return SUCCESS;
 }
