I get a lot "substr() expects parameter 3 to be long, string given memcache.inc:208 " (maybe 50-100) when I run drush (just one time).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jody Lynn’s picture

FileSize
1.09 KB

I just got the same problem all of a sudden. It's coming from the menu cache. This patch shut it up.

Berdir’s picture

Status: Active » Postponed (maintainer needs more info)

Are you using the most recent 7.x-1.x-dev snapshot?

Your patch seems to be against an old version of this module, the dmemcache_key() does not exist anymore.

JeffSheltren’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing due to inactivity. Please re-open if you're still having problems.

drasgardian’s picture

Status: Closed (cannot reproduce) » Needs review
FileSize
850 bytes

I ran into the same thing with the latest dev:

Warning: substr() expects parameter 3 to be long, string given in MemCacheDrupal->wildcards() (line 274

Following the lead of the patch above, the attached patch makes the error go away. But I don't really know how the wildcard stuff is working.

erikwebb’s picture

Status: Needs review » Needs work

This seems like we should address why $flush_length would not be set to begin with. We should elsewhere default this to zero or find the cause of an empty value.

lampson’s picture

Issue summary: View changes

I tried 7.-x-1.5 stable as well as 7.x-1.x-dev but no luck I still get this error. I applied the patch on the stable branch which worked for me.

Jeremy’s picture

Status: Needs work » Postponed (maintainer needs more info)

Perhaps this could happen with an invalid $cid (for example, if an array was passed in. With PHP 5.3.0 or greater, strlen() returns NULL when executed on arrays, and an E_WARNING level error is emitted.

Are you seeing any E_WARNING errors? Do you know what $cid is causing this? Is there anything unique about your installation?

  • Jeremy committed 4ff1489 on 7.x-1.x
    Issue #1305696 by Jeremy: substr() expects parameter 3 to be long,...
Jeremy’s picture

As I can only see one way that this would happen, I've added a check to prevent it; if you get here it will write the following to the log:
Invalid cache id received in memcache.inc wildcards() of type ___

If you're seeing this message after updating to the latest code, please paste the log here; this shouldn't happen.

Jeremy’s picture

Status: Postponed (maintainer needs more info) » Active
Issue tags: +7.x-1.6-blocker
Related issues: +#1305696: substr() expects parameter 3 to be long, string given memcache.inc

@hitfactory reports hitting this log already in #2650646: Warning: Invalid argument supplied for foreach() in MemCacheDrupal->wildcards. Needs to be reviewed before the next release.

Pobtastic’s picture

Just noticed this while using drush today;

Jan 26 11:33:12 ip-10-21-2-230 drupal: http://default 1485430392 memcache 127.0.0.1 http://default/ 0 Invalid cache id received in memcache.inc wildcards() of type integer.

Nothing else in the logs...

amme’s picture

Confirm. there is log message when using drush
WD memcache: Invalid cache id received in memcache.inc wildcards() of type integer.

  • Jeremy committed 67da4a1 on 7.x-1.x
    Issue #1305696 by Jeremy: Invalid cache id received in memcache.inc...
Jeremy’s picture

Status: Active » Fixed

Integer cid's are allowed; patch committed to fix this.

Status: Fixed » Closed (fixed)

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

Jeremy’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Closed (fixed) » Patch (to be ported)

  • Jeremy committed dd9625d on 6.x-1.x
    Issue #1305696 by Jeremy: substr() expects parameter 3 to be long,...
Jeremy’s picture

Status: Patch (to be ported) » Fixed

Backported.

Status: Fixed » Closed (fixed)

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