Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

PHP Short Tags

domdom
edited July 2005 in Vanilla 1.0 Help
Egads! I just unzipped Vanilla to install it for a play around, and to my surprise Apache was serving up the source code happy as anything. A quick rummage and it turns out that short tags have been used (delimiting the php with <? ?> rather than <?php ?>).

I know this is dead easy for me to change with a global search replace, but, since some (many in fact, I think) servers have short tags disabled (since it conflicts with xml for one), I think it may be something worth looking at.

Comments

  • lechlech Chicagoland
    99.9% of all the servers i've ever encountered have had short tags on. But yeah, probably a good point when doing xml, I never took that into account.
  • domdom
    edited July 2005
    A couple of notes on short tags from the PHP site

    Note: Also note that if you are embedding PHP within XML or XHTML you will need to use the <?php ?> tags to remain compliant with standards.

    Note: 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.

    Even if most people have short tags enabled, there's always some awkward bugger like me who turns them off ;)
  • lechlech Chicagoland
    And thanks to you, mark has another task added to the bucket of things to do! You bastard!

    j/k, good find.
  • MarkMark Vanilla Staff
    I had no idea about this. Thanks for the tip. I'll implement it for Friday's release.
  • domdom
    edited July 2005
    For anyone stuck with this and eagerly waiting for Friday's release, I used the following snippet to swap all the <? for &lt?php

    perl -pi -e '[email protected]<\?(\W)@<\[email protected]' *.php *.phtml</code> Sadly that doesn't recurse directories, although I'm sure someone semi-knowledgeable could make it so.
This discussion has been closed.