Re: [SMARTY-DEV] strip problem again

From: Date: Thu, 28 Aug 2003 17:33:50 +0000
Subject: Re: [SMARTY-DEV] strip problem again
References: 1 2 3 4  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1824@lists.php.net to get a copy of this message
On Thu, Aug 28, 2003 at 08:58:26PM +0400, Konstantin wrote: > > sorry, but if i run the example you gave, i get > > > > <table><tr><td>test texttest textTESTTESTtest > > text</td></tr></table> > > > > > > i also get that with Smarty-2.4.2, Smarty-2.5.0, > > Smarty_Compiler.class.php r1.277 and r1.278. > Well, you're right with 2.5.0: > > http://lists.php.net/article.php?group=php.smarty.dev&article=1218 > was introduced after 2.5.0 > > I just installed 2.5.0 and there is no this problem. > > > > what am i doing wrong? > > May be, you're on a Windows machine? holy moses, no. please, not even in your fantasy! > This could be the reason > for first regexp not to match. But it seems to be the fantasy of me. the \n that is matched by the first regexp is the one that the smarty-compiler emitted before, so it shouldn't be platform dependent. but i tested your example with \n and with \r\n as linebreak. with no difference. > I don't know... > > Regexps say, problem should exist :) > > > $_strip_search = array( > '%([^\\\\]\?>)\n%', // remove newlines after PHP close tags > "!{$ldq}/?strip{$rdq}|\s+$|^\s+!m", // remove leading/trailing space chars > '%[\r\n]+%m', // remove CRs and newlines > '%([^\\\\]\?>)%'); // replace newlines after PHP > > Thinking of it, I'd suppose we can safely remove > fourth replace and leave first. As Monte mentioned, normally we > need to insert newline after closing PHP tag > (or else PHP will eat extra newline which in many cases > is not good). But since designer uses {strip}, there is no need > in them. the "fix" mentioned in http://lists.php.net/article.php?group=php.smarty.dev&article=1218 was *adding* the construct above, AFAIK. but it sounds reasonable to me, too, to not bother about the ?>\n in {strip}-context. if i could reproduce the behaviour i could fix and test it, but i have to see the problem to fix it. > WBR, > Konstantin A. Pelepelin

« previous php.smarty.dev (#1824) next »