Syntax error in comment.tpl.php when php shorthand is off

Created on 8 September 2011, about 13 years ago
Updated 7 September 2024, 3 months ago

Problem/Motivation

File analytic/comment.tpl.php has a syntax error within a PHP /**/ comment block.
This causes access to nodes/comments to render improperly, with a mostly white background and no css style whatsoever. Seen with CentOS 5.6 + Drupal 7.8 + PHP 5.3.3.

Verify with:
$ cd public_html/themes/Analytic/analytic
$ php -l comment.tpl.php
PHP Parse error: syntax error, unexpected '*' in comment.tpl.php on line 13
Errors parsing comment.tpl.php

Proposed resolution

A block of 3 lines is commented out, but uses shorthand syntax <? ?>.
PHP is from stock yum install and has short_open_tag set to off.
The error is reported on line 13, but actually starts on line 11.
Original code (line 11):

<?/*php print render($title_prefix); ?>

Proposed fix (line 11):

/*print render($title_prefix);

Remaining tasks

I'm not sure why the 3 lines of code are blocked out, but using long-form syntax gets rid of the error on a php engine compiled with short_open_tag off.

Note file node.tpl.php uses a similar shorthand but does not generate a php error. I suspect the difference is it's contained within a single php statement, whereas the block in comments.tpl.php spans multiple statements. Anyway it's probably best to avoid shorthand syntax anyway.

User interface changes

None

API changes

None

Original report by [username]

N/A

๐Ÿ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States dneedham

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024