Download & Extend

Notice: Undefined offset: 0 in mongodb_collection()

Project:Mongodb
Version:7.x-1.0-beta2
Component:Cache
Category:bug report
Priority:major
Assigned:Unassigned
Status:closed (works as designed)

Issue Summary

I am try with mongodb 2.02 in drupal 7.10 version.

and found the error:

tail -f apache2/error.log
[Sun Dec 18 06:57:29 2011] [error] [client 58.251.102.36] PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0, referer:

report:
Notice: Undefined offset: 0 in mongodb_collection() (line 44 of /opt/www/sites/all/modules/mongodb/mongodb.module).

How to fix it? Thanks,

Comments

#1

I try catch the code and print the stack info, find MongoDB->selectCollection(''), it is a emty string

find:#0 /opt/www/sites/all/modules/mongodb/mongodb.module(67): MongoDB->selectCollection('')
#1 /opt/www/sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc(120): mongodb_collection(NULL)
#2 /opt/www/includes/cache.inc(137): DrupalMongoDBCache->set(NULL, Array, 0)
#3 /opt/www/includes/theme.inc(431): cache_set(NULL, Array, NULL)
#4 /opt/www/includes/bootstrap.inc(416): ThemeRegistry->set(NULL, Array, NULL)
#5 [internal function]: DrupalCacheArray->__destruct()
#6 {main}

#2

I found the reason:
in the class DrupalMongoDBCache,
the variable $bin is an empty String ,

but how to fix it?

#3

include_once('./includes/cache.inc');

# -- Configure Cache
$conf['cache_backends'][] = 'sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc';
$conf['cache_class_cache'] = 'DrupalMongoDBCache';
$conf['cache_class_cache_bootstrap'] = 'DrupalMongoDBCache';
$conf['cache_default_class'] = 'DrupalMongoDBCache';

# -- Don't touch SQL if in Cache
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;

#4

I was having a similar issue and it was due to a core bug #1371484: Private properties in abstract class DrupalCacheArray.

But it seems that #3 may have fixed the issue. Is that the case?

#5

Status:active» closed (works as designed)

No more information about this one, so I am closing. If this was wrong, please reopen.

nobody click here