Got Error, need help

Started by helpless, May 04, 2008, 11:11:54 AM

Previous topic - Next topic

helpless

Got this error in forum error log:

2: memcache_get_version() expects exactly 1 parameter, 0 given
File: /home/respirat/public_html/Sources/Admin.php
Line: 244

anyone know how to fix it?
currently using SMF 1.1.5

Oldiesmann

Sources/Admin.php

Find
if (function_exists('memcache_set'))
$context['current_versions']['memcache'] = array('title' => 'Memcached', 'version' => memcache_get_version());


Replace
// We can't get the memcache version without connecting to a host first...
if (function_exists('memcache_set') && !empty($modSettings['memcache_cache']))
{
// SMF allows you to specify multiple memcache hosts... Just pick the first one...
$servers = explode(',', $modSettings['memcache_cache']);

// Assume that they're not using a custom port by default...
$server = $servers[0];
$port = 11211;

// Custom port?
if(strpos($servers[0], ':') !== false)
list($server, $port) = explode(':', $servers[0]);

// Connect
$memcache = memcache_connect($server, $port);

// Get the version
$context['current_versions']['memcache'] = array('title' => 'Memcached', 'version' => memcache_get_version($memcache));

// Close connection
memcache_close($memcache);
}


It's a lot more code, but you can't get the memcache version without connecting to a server first.
Michael Eshom
Christian Metal Fans

SleePy

As a note this was already logged as a bug but appears to be fixed and should be in the next release of SMF 1.1

Bug #1976: memcache_get_version() expects exactly 1 parameter, 0 given
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Advertisement: