0

Tried to update our website from Joomla 2.5.9 to 2.5.22 and it broke the site, giving me the error:

Fatal error: Cannot redeclare word_count() (previously declared in domain/templates/rt_momentum/overrides/mod_rokgallery/templates/slideshow/default.php:9) domain/templates/rt_momentum/overrides/mod_rokgallery/templates/slideshow/default.php on line 24

The code it refers to is this block (running from line 9-24):

function word_count($str, $asArray = 0){

    $count = preg_match_all("/\d{1,}|\p{L}[\p{L}\p{Mn}\p{Pd}'\x{2019}]*/u", $str, $matches);

    if ($asArray == 2){
        $positions = array();
        $cursor = 0;
        foreach($matches[0] as $value){
            $positions[$cursor] = $value;
            $cursor += strlen($value) + 1;
        }

        return $positions;
    } else {
        return $count;
    }
}

Site support have tried to help, but referred me here.

Any help greatly appreciated!

Scott

Alexander O'Mara
  • 58,688
  • 18
  • 163
  • 171
  • 1
    Based on your error, your file is being `include`d or `require`d multiple times, thus causing your function redeclaration error. You should investigate why this is (I don't work with Joomla). – Alexander O'Mara Jul 13 '14 at 21:53

1 Answers1

0

It looks like the problem is in your template rather than core Joomla. Have you updated this to the latest version as well? Rocket Themes may have released a patch to deal with this issue.

I'd also try unpublishing mod_rokgallery from your module manager, as it looks like the problem is specifically in your template's override for that (or at least that may reduce the chances of the word count function being called in too many places).

Failing that, the Rocket Themes forum may be a better place to ask the question, as the devs of that module should be on-hand to help, and it looks to be a Rocket Themes question rather than a Joomla one: http://www.rockettheme.com/forum

RichardB
  • 2,615
  • 1
  • 11
  • 14