Search code examples
phpjoomla

php - joomla: strange syntax error occurs only in localhost


On the server (PHP 5.6.38) I have a website in Joomla which works fine, I tried to move it to localhost (Uniserverz XIII - PHP 5.6.30) to test some updates but I get an error when I set $error_reporting = 'development':

Parse error: syntax error, unexpected '}' in C:\UniServerZ\www\site_name\templates\site_temp\html\modules.php on line 64

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

Solution

  • Set short_open_tag=On in your php.ini

    and restart your Apache server