thyseus / yii-user-management

a user management module collection for the yii framework
185 stars 122 forks source link

PHP short tags not universally supported #7

Closed michaw closed 12 years ago

michaw commented 12 years ago

In the recent commit, all PHP tags (<?php) were changed to PHP short tags (<?). This change makes the extension LESS useful as not all servers with PHP will support the short tag.

Please PLEASE roll back this commit.

thyseus commented 12 years ago

In addition to this[http://stackoverflow.com/questions/200640/are-php-short-tags-acceptable-to-use] good discussion about php short tags, they are enabled by default since php 5.4:

<?= (the short echo syntax) is now always available regardless of the value of the short_tags ini setting. This should make templating system authors happy.

If there still is a host around that disables short tags, you can simply do a global substitute <? to <?php, and everything will be fine.

michaw commented 12 years ago

I understand the desire to use short tags, however as a production developer I have to disagree. While short tags are increasing in support, if you are developing code for others to use, you should be making it as easy as possible for as many as possible to use your code. This change makes it harder for many to use this extension, and serves no purpose apart from saving a few KB. The requirement for Yii is PHP 5.2, and PHP 5.4 is rarely available on commercial hosting services. Even still, this change goes against the concept of 'maximum compatibility' that should be employed when writing code for others to use. Sure, it's easy enough to do a find and replace, by why make potential users do that? What purpose does it serve?

michaw commented 12 years ago

In addition, that discussion on stackoverflow seems genuinely split, with even advocates of short tags acknowledging that unless you have complete control of your hosting environment, you should use long tags. Since you're writing an extension with absolutely no knowledge of the target environment, let alone control, wouldn't it be prudent to use long tags?

thyseus commented 12 years ago

How about this compromise:

In git, for development, we use short <? tags. As soon as we do a packaged release, i include the <?php tags for deployment on foreign hosters.

Speaking about that; its time for another release ;)

michaw commented 12 years ago

That sounds like an acceptable compromise :)