Whitespace issue in 2.5.0
| From: | Peter Bowen | Date: | Sun, 25 May 2003 18:43:04 +0000 |
| Subject: | Whitespace issue in 2.5.0 | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-1512@lists.php.net to get a copy of this message | ||
I recently upgraded from Smarty 2.3.0 to 2.5.0 and discovered that none
of my templates work correctly anymore. After a little poking, I
discovered that the compiled output of the following template changed:
{*
$Id: header.tpl,v 1.21 2003/03/11 22:29:14 pzb Exp $
*}
{assign var="pageid" value=$pageid|default:"unknown"}
{HTTPHeader name="X-PageID" value="$pageid"}
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
<head>
<title>{$heading|default:"Foo Inc Program"}</title>
<script language="JavaScript">
{literal}
.....
The problem is that in 2.3.0 smarty gobbled up the new lines after the
plugin calls, while in 2.5.0 it is leaving them in the code. This is
causing problems for me because the HTTPHeader plugin call is supposed
to put out a HTTP header, which can't happen after output has started.
Interestingly, the newline after the comment, before the assign plugin
call, is not being output.
The attached patch removes the bare newlines, but I'm not sure if it
will break things for other people.
Thanks.
Peter