Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Use of short tags

#69

Hi,

Several of the PHP files within Concerto use short tags instead of complete tags, ie <? instead of <?php. This is rather non-portable, and causes major breakage on SUSE systems at the very least. It can be worked around by changing short_open_tag = On, but this is not the default shipping setting for SuSE and possibly others, and is also not recommended.

To quote from php.ini on SuSE, Ubuntu and Debian distros - "Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags."

I've had a quick look, and there's quite a few files that at least have it as the opening line. There are many more with it embedded in the file somewhere

root@flat:/var/www/concerto# find . -iname "*.php" -exec grep -i '<?$' {} \; | wc -l
58
root@flat:/var/www/concerto#

I'm sure there's a way to mass replace it all with sed/grep/find/etc!

Regards

Kyle

Reported by Kyle Gordon · February 8th, 2010 @ 07:04 PM

State: resolved
Milestone: none
Assigned to: nobody

Activity

  1. Brian Michalski
    Brian Michalski

    You've got a valid point, our code is covered in short tags. We've used short tags because they're much easier on the eyes when you're editing the code than a <?php echo $foo ?>. Compressing a statement like that to <?= $foo ?> saves a few characters and makes the code a tad easier to follow.

    This site: http://mantis.phplist.com/view.php?id=1175 references a script that might do it, but I can't vouch for its effectiveness.

    February 11th, 2010 @ 10:27 PM

  2. Brian Michalski
    Brian Michalski
    • State changed from new to hold

    I'm not going to mark this invalid because its a completely valid problem. We'll need to talk about this at some point.

    February 11th, 2010 @ 10:32 PM

  3. Andrew Elwell
  4. Kevin Russell
    Kevin Russell
    • Milestone order changed from 0 to 0

    Although I didn't use the patch supplied by Andrew (link appear broken), I have pushed similar fix to GitHub (non-cas). I need to use the long tags in my environment.

    July 20th, 2011 @ 12:59 AM

  5. Brian Michalski

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.