Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The string ?> in templates causes smarty to ignore line breaks #501

Closed
SergeyTsalkov opened this issue Oct 20, 2018 · 1 comment
Closed

Comments

@SergeyTsalkov
Copy link

Code:

$Smarty = new Smarty(); // v3.1.33, latest
$template1 = "eval:line 1\nline2";
$template2 = "eval:line 1?>\nline2";
$template3 = "eval:line 1?> \nline2";
var_dump($Smarty->fetch($template1));
var_dump($Smarty->fetch($template2));
var_dump($Smarty->fetch($template3));

Results:

string(12) "line 1
line2"
string(13) "line 1?>line2"
string(15) "line 1?>
line2"

In the second var_dump, the line break was dropped because of the ?> string immediately before it. Adding a space immediately after the ?> seems to cure it.

uwetews added a commit that referenced this issue Oct 29, 2018
…"\n" (newline) character if it did directly followed

   a PHP tag like "?>" or other #501
@uwetews
Copy link
Contributor

uwetews commented Oct 29, 2018

The fix is now in the master branch and will later be included in 3.1.34

@uwetews uwetews closed this as completed Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants