Deprecated function: MongoBinData::__construct(): The default value for type will change to 0 in the future. Please pass in '2' explicitly. in DrupalMongoDBCache->set() (line 131 of ......../sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc).

I believe this doesnt seem to be much of an issue, but it does affect the performance a little as it keeps on flooding the watchdog with every request.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fgm’s picture

Status: Active » Needs review
FileSize
975 bytes

Note: this warning is new in version 1.2.11 of the extension.

Going further, I wonder whether there would not be more to gain from alway using a MongoBinData::BYTE_ARRAY instead of routing each string data through drupal_validate_utf8() as the check currently does.

This probably needs performance testing, but that would be a followup issue.

Status: Needs review » Needs work

The last submitted patch, 0001-Issue-1786330-MongoBinData-__construct-needed-an-exp.patch, failed testing.

regilero’s picture

+1 flooding the watchdog on each cache operation is bad.

jonloh’s picture

Status: Needs work » Reviewed & tested by the community

Applied patch from #1 and it seems to be not flooding the logs anymore. Should consider this to be comitted :)

Thanks fgm!

mgifford’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 0001-Issue-1786330-MongoBinData-__construct-needed-an-exp.patch, failed testing.

pipep’s picture

How can I make it go away ?? I uninstalled the mongodb_cache submodule, and no results.

Deprecated function: MongoBinData::__construct(): The default value for type will change to 0 in the future. Please pass in '2' explicitly. in DrupalMongoDBCache->set() (line 131 of /D723/sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc).

If I remove from settings.php

#   # -- Configure Cache
   $conf['cache_backends'][] =
     'sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc';
   $conf['cache_default_class']         = 'DrupalMongoDBCache';
#   # -- Don't touch SQL if in Cache
   $conf['page_cache_without_database'] = TRUE;
   $conf['page_cache_invoke_hooks']     = FALSE;

I get white screen with the following error:

2013/09/15 20:39:25 [error] 2242#0: *2661 FastCGI sent in stderr: "PHP message: PHP Catchable fatal error: Argument 2 passed to SelectQuery::fields() must be of the type array, null given, called in /D723/includes/entity.inc on line 279 and defined in /D723/includes/database/select.inc on line 1300" while reading response header from upstream, client: 00.000.000.00, server: domain.com, request: "GET /admin/reports/status/run-cron HTTP/1.0", upstream: "fastcgi://unix:/tmp/php-fpm.sock:", host: "domain.com", referrer: "http://domain.com/"

Any help appreciated.
Thanks for the module.

Update: doesn't matter, started a new instance as the sub module full filled my setup with errors. Im using nginx, varnish, memcache, Maria DB and Mongo DB. Skipping from the beginning mongodb cache and mongodb block solved my problems. cheers.

pipep’s picture

Issue summary: View changes

Added formatting.

fgm’s picture

Version: 7.x-1.0-rc2 » 7.x-1.x-dev
Issue summary: View changes
Status: Needs work » Needs review
FileSize
2.35 KB

Things changed since then : the default is now MongoBinData::GENERIC instead of BYTE_ARRAY. Rerolled on top of #2547411: Match core flushing logic and ensure expiration always happens to be able to use the cache tests (passing).

  • fgm committed 9fe20a7 on 7.x-1.x
    Issue #1786330 by fgm: Fixed missing $type on MongoBinData constructor.
    
fgm’s picture

Status: Needs review » Fixed

Committed to 7.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

donquixote’s picture

Status: Closed (fixed) » Needs work

I still get this showing up in my logs.

My PhpInfo shows MongoDB version 1.4.5.
But the code still uses the first version of getBinDataCreator(),

    if (version_compare('mongo', '1.2.11') < 0) {
      $result = function ($data) {
        return new \MongoBinData($data);
      };
    }

Why?
Because version_compare($x, $y) wants both $x and $y to be correct version strings.
It does not look up the version of an extension.

This is what we want:
http://stackoverflow.com/a/14626296/246724

    $mongo_version = phpversion('mongo');
    if (version_compare($mongo_version, '1.2.11') < 0) {
      $result = function ($data) {
        return new \MongoBinData($data);
      };
    }
donquixote’s picture

Status: Needs work » Needs review
FileSize
887 bytes

Interesting, I cannot test this against 7.x-1.x, only 8.x-1.x.
No tests existing?

  • fgm committed c0d8929 on 7.x-1.x
    Issue #1786330 by donquixote,fgm: fixed version_compare usage.
    
    -...
fgm’s picture

Status: Needs review » Fixed

Thanks for the patch, committed to todays 7.x-1.x HEAD.

Regarding tests, they can not run on d.o. QA as such, because they need a MongoDB instance and the classic qa.d.o. does not have this, but you can run them locally if you have a MongoDB instance on localhost:27017.

The new container-based QA infra should allow instantiating MongoDB for tests, but I still haven't found time to check how to do this. Help welcome.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.