I moved a website from server (PHP 5.6.38) to localhost (PHP 7.2.10). And I receive this error in the page title (in the chrome tab):
0 - Using $this when not in object content
While searching online I found that I have to replace all instances of JSite::getMenu()
with JFactory::getApplication()->getMenu()
, I did it with no luck. I changed the theme and the error dissapeared, so its probably something with the theme. I tried to edit the theme but I receive this error :
An error has occurred.
0 syntax error, unexpected '}', expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF)
Return to Control Panel
But there is no information where this error is.
I downloaded again the template files from server, replace the local ones but still get the same error, while on the live server there is no such error
EDIT
I enabled error_reporting
and I get this error:
Parse error: syntax error, unexpected '}' in C:...\html\modules.php on line 64
The problem is that the file is identical with the one on the server and on the server I dont get any error...
Here is the code:
function modChrome_myCatMod($module, &$params, &$attribs)
{
$moduleTag = $params->get('module_tag', 'div');
$headerTag = htmlspecialchars($params->get('header_tag', 'h3'));
$bootstrapSize = (int) $params->get('bootstrap_size', 0);
$moduleClass = $bootstrapSize != 0 ? ' span' . $bootstrapSize : '';
// Temporarily store header class in variable
$headerClass = $params->get('header_class');
$headerClass = ($headerClass) ? ' class="' . htmlspecialchars($headerClass) . '"' : '';
if (!empty ($module->content)) : ?>
<<?php echo $moduleTag; ?> class="moduletable<?php echo htmlspecialchars($params->get('moduleclass_sfx')) . $moduleClass; ?>" id="Mod<?php echo $module->id;?>">
<?php if ((bool) $module->showtitle) : ?>
<?php $com_content_categories = $params->get('com_content_categories'); if(!empty($com_content_categories)):
$caturl = ContentHelperRoute::getCategoryRoute ( $com_content_categories[0] );
?>
<<?php echo $headerTag . $headerClass . '>' ?><a href="<?php echo $caturl;?>"><?php echo $module->title; ?></a></<?php echo $headerTag; ?>>
<?php else : ?>
<<?php echo $headerTag . $headerClass . '>' . $module->title; ?></<?php echo $headerTag; ?>>
<? endif;?>
<?php endif; ?><?php echo $module->content; ?>
</<?php echo $moduleTag; ?>>
<?php endif;
} //////////////////////////////////error line
development
it should provide a stack trace