Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36311 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27796 invoked from network); 22 Mar 2008 01:46:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Mar 2008 01:46:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=steph@zend.com; spf=permerror; sender-id=softfail Authentication-Results: pb1.pair.com header.from=steph@zend.com; sender-id=softfail Received-SPF: error (pb1.pair.com: domain zend.com from 64.97.136.187 cause and error) X-PHP-List-Original-Sender: steph@zend.com X-Host-Fingerprint: 64.97.136.187 smtpout0187.sc1.he.tucows.com Solaris 8 (1) Received: from [64.97.136.187] ([64.97.136.187:41790] helo=n064.sc1.he.tucows.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/1A-26785-7F464E74 for ; Fri, 21 Mar 2008 20:46:34 -0500 Received: from sc1-out09.emaildefenseservice.com (64.97.139.2) by n064.sc1.he.tucows.com (7.2.069.1) id 4769770500F554AF; Sat, 22 Mar 2008 01:46:27 +0000 X-SpamScore: 2 X-Spamcatcher-Summary: 2,0,0,a5474cb1e79ae7ec,b35dec7e800aa2b5,steph@zend.com,-,RULES_HIT:2:355:379:539:540:541:542:543:567:599:601:945:960:973:982:988:989:1155:1156:1260:1277:1311:1313:1314:1345:1437:1515:1516:1518:1535:1587:1593:1594:1605:1606:1730:1747:1766:1792:2073:2075:2078:2198:2199:2377:2393:2559:2562:2693:2731:2828:3027:3865:3866:3867:3868:3869:3870:3871:3872:3873:3874:4119:4250:5007:6117:6119:6261:7653:7875:7903:7904,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck: none,DomainCache:0,MSF:not bulk,SPF:,MSBL:none,DNSBL:none X-Spamcatcher-Explanation: Received: from foxbox (62-31-252-198.cable.ubr07.shef.blueyonder.co.uk [62.31.252.198]) (Authenticated sender: steph.fox) by sc1-out09.emaildefenseservice.com (Postfix) with ESMTP; Sat, 22 Mar 2008 01:46:25 +0000 (UTC) Message-ID: <01d401c88bbe$a0e0bff0$c6fc1f3e@foxbox> Reply-To: "Steph Fox" To: "Rasmus Lerdorf" , "Elizabeth M Smith" Cc: References: <47E3F714.60302@zend.com> <883216194.20080321193140@marcus-boerger.de> <47E40848.1060103@zend.com> <47E40C3F.8040601@sci.fi> <47E40E6E.5030103@zend.com> <47E410C6.80605@sci.fi> <47E4146A.8010409@zend.com> <47E41765.4080007@zend.com> <111239762.20080321212310@marcus-boerger.de> <47E41C9F.4040105@zend.com> <935033306.20080321223836@marcus-boerger.de> <68.F2.26785.55E24E74@pb1.pair.com> <47E450B1.9040604@lerdorf.com> Date: Sat, 22 Mar 2008 01:47:00 -0000 Organization: Zend Technologies MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Subject: Re: [PHP-DEV] short_open_tag From: steph@zend.com ("Steph Fox") > Elizabeth M Smith wrote: >> Wow, noisy... >> >> I've been in the situation where I use php for templating and the short >> syntax is much nicer on the eyes. The ability to "flick the switch" for >> short tags would be nice. >> >> However, like Steph, I've also been bitten by having a simple xml >> declaration in a file with short tags on that completely breaks things. >> Parse errors are NOT a good thing. This is why I'd personally prefer >> short tags just go poof - having to check all your code so any >> appearance of > >> I'd argue that a > the difference" between the ugliness of the long version and the need to >> not break php every time an xml declaration pops up in a file. Even >> gettext has a nice _() function shortcut which is less typing than echo >> $blah; in every php tag set, and then you wouldn't be fighting with the >> potential breakage. The argument that if some new syntax only goes into >> 5.3, people can't use it doesn't really hold water here because you >> wouldn't be able to rely on flipping the short_tags switch before 5.3 >> either. >> >> I can see both sides of the story, and really don't have a preference - >> I'm curious as to the opinions of someone OTHER than Marcus, Stas, >> Pierre and Jani ;) > > There are a bunch of factors here. In the end it comes down to the > purists vs. the pragmatists. You all know where I fall on that one. is for the purists and > Now, someone mentioned the purist side. A PI tag is defined as and I am > pretty sure the PI label names can't contain '='. adopted in order to be correct, let's not break that correctness. > > Most of the arguments I have seen are basically saying shouldn't even exist, but that isn't the current question. It does exist, > and we aren't removing it, so the only real argument here is the WTF > factor introduced by code that is able to enabled or disable these tags on > the fly. That's the one and only valid argument I have seen. Whether or > not PHP code can be validated with xmllint and whether or not xml, which it obviously isn't, is completely beside the point. We all > know that when you use majority that's ok. XHTML is dead because IE, which is unfortunately the > dominant browser has never and never will support XHTML. Yes, you can > hack it and serve up XHTML with an HTML mime type and apply various hacks > to sort of almost maybe sometimes get it to work in IE, but nobody who > does any serious web development uses XHTML for sites that have wide > audiences. > > So, we are down to a very simple decision. Does the added WTF factor of > dynamically changing short_open_tags outweigh the benefits to the folks > using > My view is that people want templating. As much as I hate the concept, > and have always been very vocal about that, people want simpler templating > tags. They will even go as far as parsing files and generating PHP code > on every single request in order to use {blah} instead of . > The fact that people are willing to take an order of magnitude performance > hit for syntactic sugar is baffling to me, but just look at all the > templating systems out there. And yes, I know there are other reasons to > use templating such as restricting the feature set for untrusted template > writers, etc. but you'd be surprised how many people just want to type > less and have their tags be prettier. Getting these folks to switch to > is a win for performance and sanity in my book. Yes, it isn't > a full victory, but it is still a win. > > In order for a templating system to use short_open_tag on for the entire system. By allowing them to only apply > the short_open_tags to certain parts of their code it means that they will > write correct the actual included template files. Again, not a full victory, but a win > for us in the sense that the actual PHP code in their application will be > using business logic because it won't work due to limiting the short_open_tags > to just the templates. > > I recognize the WTF factor of dynamically changing the setting, but > frankly since it can already be changed per-dir from one request to the > next on the same server, I really don't see the incremental WTF factor as > being very high. > > Consider the fact that: > > virtual('templates/main.php'); > ?> > > and > > ini_set('short_open_tag',true); > include 'templates/main.php'; > ini_set('short_open_tag',false); > ?> > > Will actually do about the same thing in the sense that the top-level > script can run with short_open_tag turned off and the main.php script can > run with short_open_tag enabled. The first version requires that you > configure your Apache to enable short_open_tag for the templates/ > directory, while the second lets you do it from the PHP level. The first > suffers from being extremely slow and it isn't obvious that scripts in > templates/ operate under different rules. The second is much faster and > it is more obvious what is happening. Ok here's a stupid suggestion. Is it at all possible to turn off (for all time) short_tags in php.ini BUT allow scripts that want to use short-tags to explicitly use them via ini_set()? It might mean a lot of re-thinking... and yes I do know it's not currently an option :) - Steph