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

strip inserts space after comments. #943

Open
st19311 opened this issue Feb 26, 2024 · 4 comments
Open

strip inserts space after comments. #943

st19311 opened this issue Feb 26, 2024 · 4 comments

Comments

@st19311
Copy link

st19311 commented Feb 26, 2024

{strip}
    Test{* This is only a test! *}
    ing th
    e strip function
{/strip}

results in

Test ing the strip function

with a space after Test.
Removing the comment results in the removal of the space.

Happenes in the newest smarty-version, didn't test the others.

@wisskid
Copy link
Contributor

wisskid commented Feb 26, 2024

Seems related to #447
May be tricky to 'fix' as this might mean unwanted changes for others.

@st19311
Copy link
Author

st19311 commented Feb 26, 2024

Mmm I see.

Well, I used Smarty 3.1 up to now (long term app, now upgraded to PHP 8.3), and that didn't have this issue (as in, strip did indeed strip all whitespace). So it must have been introduced some time after - and yea, that definitely was an unwanted change at least for me (and the other guy in #447).

It's your call what you do, but since Smarty didn't have this issue before, it seems like a regression introduced somewhere, and anyone who has an issue with a fix has essentially become reliant on a bug ;P

It also seems to make little sense to keep this behavior, because {strip} specifically states that it removes all whitespace - and well, no, it doesn't. It keeps one in there after a comment (which shouldn't have any effect on the output to start with). Which makes the documentation wrong ;)

My workaround is to compile the smarty templates myself before passing them to smarty, removing all the comments, so I still have them in the original files, and smarty doesn't see them anymore - but you know, that's hacky as all hell ;)

@wisskid
Copy link
Contributor

wisskid commented Feb 26, 2024

It was meant as a note to myself, no worries. Can you figure out what change/version introduced it?

@wisskid
Copy link
Contributor

wisskid commented Feb 28, 2024

The problem seems to be identical as/related to #827 and #555, both caused by a fix in 2017/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