Re: newlines in files

From: Date: Thu, 25 Oct 2001 17:05:15 +0000
Subject: Re: newlines in files
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1722@lists.php.net to get a copy of this message
On Thu, 25 Oct 2001, Monte Ohrt wrote: > It was brought to my attention (by Roberto Berto) that there are > newlines at the end of the Smarty files. I thought this was a bit odd at > first, but yes they are in there. But, this seems to be the case with > any file. > > For instance, with the VI editor (I tried nedit too), open a file, type > "foo", then save it. If you do a raw dump of the file content, you will > see that it does contain a new line "foo\n". I suppose this is they way > (any?) editor behaves, putting this in as an EOF marker. > > So I'm wondering, is this a concern? Usually this would be a no, as a > newline in an HTML document doesn't normally cause an issue. But it can, > and especially if the content is something other than HTML or the > content is encapsulated somehow. This also goes for all the templates > you build with Smarty. They all most likely have newlines attached to > the end. > > I'd like so see what other peoples thoughts are on this one. Do we take > care to remove the newlines from the Smarty class files? This would > involve a post-stripping of the newline anytime the file is edited I > would think, unless I'm missing something obvious. > I was just about to say that this is probably not an issue since I'm using Smarty on my test environment and I create cookies after include()'ing Smarty.class.php (or whatever the name is, don't remember), but I just remembered that I use ob_start() on all my files, so it might be caching the output and handling header problems on its own. Theoretically the newline would cause the infamous 'headers already sent' problem that virtually every PHP newbie complains about. Am I wrong here? This is quite confusing, since if every editor adds the newline to all files, how can other files be include()'ed and this error message not show up? </extra confused> I didn't have time to think about this, so please bear with me here. Joao -- João Prado Maia <jpm@phpbrasil.com> http://phpbrasil.com - php com um jeitinho brasileiro -- Precisando de consultoria em desenvolvimento para a Internet ? Impleo.net - http://impleo.net/?lang=br

« previous php.smarty.general (#1722) next »