Page 1 of 1
Quick question
Posted: Wed Sep 26, 2007 11:21 am
by Flamie
Hey guys, I'm just wondering what is the setting in PHP.ini that I need to change in order to enable/disable this:
<?=$page?> (this is the same as <? echo $page;?>)
Thanks!
Re: Quick question
Posted: Wed Sep 26, 2007 11:44 am
by Zoxive
Flamie wrote:Hey guys, I'm just wondering what is the setting in PHP.ini that I need to change in order to enable/disable this:
<?=$page?> (this is the same as <? echo $page;?>)
Thanks!
But, this is not recommended, i can't remember where, but i'm pretty sure this is removed in future versions of php.
Posted: Wed Sep 26, 2007 11:44 am
by feyd
Never enable it. Ever.
Posted: Wed Sep 26, 2007 11:46 am
by Flamie
Yeah I know its not a good thing to use, I just needed to know for reference.
Thanks a lot dudes.
Descriptive subjects
Posted: Wed Sep 26, 2007 11:52 am
by Luke
Sometimes you need to enable it. Some people write applications with the short open tag on unfortunately.

For instance...
magento...

.
And to flamie:
Re: Descriptive subjects
Posted: Wed Sep 26, 2007 11:56 am
by feyd
The Ninja Space Goat wrote:Sometimes you need to enable it. Some people write applications with the short open tag on unfortunately.

For instance...
magento...

.
Not true. You have three options:
- modify the code yourself to not use it -- fairly easy.
- push the developer(s) to fix their code -- can be challenging.
- use a different codebase that is written correctly -- variable difficulty depending on the niche level of the library in question.
Posted: Wed Sep 26, 2007 12:51 pm
by Luke
In the real world with project deadlines none of these options are practical or realistic.
1. modify the code yourself to not use it -- fairly easy.
Magento's codebase is huge and it's riddled with <?=$this?> and <? everywhere. There is no easy way to remove them. Even if there was, you have to do it again every time you update.
2. push the developer(s) to fix their code -- can be challenging.
Like you said this can be challenging. Eventually I have a feeling magento will change this, but I wouldn't count on that any time soon.
3. use a different codebase that is written correctly -- variable difficulty depending on the niche level of the library in question.
Find another decent PHP ecommerce app with the features magento has. It is totally worth turning on short_open_tags to get the functionality magento provides.
there are most definitely exceptions.
Posted: Wed Sep 26, 2007 2:35 pm
by feyd
The Ninja Space Goat wrote:Magento's codebase is huge and it's riddled with <?=$this?> and <? everywhere. There is no easy way to remove them. Even if there was, you have to do it again every time you update.
There's a simple, easy way. You can easily write an adapter script that fixes it when installing the new codebase.
The Ninja Space Goat wrote:there are most definitely exceptions.
I have yet to find any.
Posted: Wed Sep 26, 2007 2:50 pm
by stakes
Could someone please elaborate why short tags should not be used? Is it just deprecated or does it actually affect the code?
Posted: Wed Sep 26, 2007 2:58 pm
by Luke
There's a simple, easy way. You can easily write an adapter script that fixes it when installing the new codebase.
hmm... enable one configuration directive or write an adapter script for an entire codebase... I choose the configuration directive. My client is happy with this choice... saves him a few hundred bucks.
Posted: Wed Sep 26, 2007 3:53 pm
by feyd
Keeping short tags won't be supported in PHP 6, so if you ever plan to run on it.. you'll have to convert. Secondly, if you have XML in your files, it will generate parse errors unless you make accommodations. Lastly, it's a vestige from an older time that promotes poor, incompatible code -- because it's an option that can be turned off if a server admin chooses.
Posted: Thu Sep 27, 2007 9:07 am
by The Phoenix
The Ninja Space Goat wrote:In the real world with project deadlines none of these options are practical or realistic.
1. modify the code yourself to not use it -- fairly easy.
Magento's codebase is huge and it's riddled with <?=$this?> and <? everywhere. There is no easy way to remove them. Even if there was, you have to do it again every time you update.[/quote]
1. There is a perl one-liner for that. Its search replace from <?=$this to <?php echo $this.
2. Run the script before the update
3. Best - submit the fixes (and it is a fix) upstream to the project. They would likely be extremely appreciative.
The Ninja Space Goat wrote:2. push the developer(s) to fix their code -- can be challenging.
Like you said this can be challenging. Eventually I have a feeling magento will change this, but I wouldn't count on that any time soon.
Offering a "click and its done" patch to the upstream goes a long way towards getting their help.
The Ninja Space Goat wrote:3. use a different codebase that is written correctly -- variable difficulty depending on the niche level of the library in question.
Find another decent PHP ecommerce app with the features magento has. It is totally worth turning on short_open_tags to get the functionality magento provides.
there are most definitely exceptions.
Is it possible to turn on short_open_tags per virt host? I suspect it is in .htaccess, which would limit the requirement a bit.
Posted: Thu Sep 27, 2007 3:03 pm
by Saharian
Hm... could you point me somewhere that says that short tags are deprecated and which version of php it's going to happen?
Because here it says that php6 is going to have them:
http://www.php.net/~derick/meeting-note ... dd-php-var