Re: Is there a technical reason <?= considered a "short tag"?
| From: | Rasmus Lerdorf | Date: | Fri, 05 Jun 2009 05:47:22 +0000 |
| Subject: | Re: Is there a technical reason <?= considered a "short tag"? | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44171@lists.php.net to get a copy of this message | ||
Roman I wrote:
> Philip Olson wrote:
>> On May 30, 2009, at 12:49 PM, Roman I wrote:
>>
>>> Philip Olson wrote:
>>>> On May 18, 2009, at 5:33 PM, Roman I wrote:
>>> This neither answers nor invalidates the original question, though.
>> Unfortunately I do not remember everything about this but do know that:
>>
>> - Decoupling <?= from short_open_tag was discussed, and did not
>> happen
>> - Allowing it to be enabled at runtime was discussed, and did not
>> happen
>> - The issues with <?= and <? are similar... an invalid PI
>>
>> I've not read every thread or discussion on this (there are many) but
>> CVS speaks for itself. Here's one thought comparing the two viewpoints:
>>
>> -
>> http://marc.info/?l=php-internals&m=120614525214419&w=2
>>
>> The following RFC mentions this decoupling, yet was declined:
>>
>> - http://wiki.php.net/rfc/shortags
>>
>> And lastly, the general topic of short tags came up recently while
>> several people discussed PHP 6:
>>
>> - http://wiki.php.net/summits/pdmnotesmay09
>>
>> In summary: It's a topic people don't want to talk about. :)
>>
>> Regards,
>> Philip
>
> Thanks for the references. I've seen the RFC, but I haven't seen that thread
> you've linked to. It does contain almost all things I could say here.
> However, I haven't found very strong argument against decoupling in that
> thread either. :)
>
> Even without short tags, PHP will not be a well-formed XML processing
> instruction in many cases. For example,
> <?php $x = '<?>'; ?>
> or, more commonly:
> <root test="<?php echo $value; ?>" />
>
> Plain <? has an additional problem of affecting the ability to include XML
> files from PHP source code. However, it seems to me that using the syntax
> above will have exactly the same consequences for XML well-formedness as
> using <?=. Since the syntax above is allowed with short_open_tags off,
> disallowing <?= with that setting off looks like an overkill. That's my
> reasoning behind starting this thread, anyway.
>
> Admittedly, I haven't said anything new here, but I've rephrased an old
> argument in a nicer way. :)Maybe it will do some good.
Right, I think that is actually the conclusion we came to at one point.
I don't remember the discussion that caused the RFC to be declined. I
would be in favour of reversing that decision wherever it came from.
Nobody is going to pass a PHP script through an XML parser, and PHP
itself will never be well-formed, so that is a lost cause. We'd have to
start tossing CDATA blocks and write code like:
if( 2 < 3 ) echo "2 is less than 3";
And that just isn't going to happen. The only valid argument against
short_tags itself is that it clashes with named PI tags and <?= does not
have that same problem.
-Rasmus