Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

twig - PHP 7.4 trimming whitespace between string variables

I'm running into an issue where when I have multiple variables being output into a class attribute, they all get compressed into a single word rather than kept as separate words as originally authored, as in

<div class="className {{ variable1 }} {{ variable2 }}"><div>

At runtime this is being rendered as:

<div class="className variable1variable2"><div>

Any idea what would cause this and how to avoid it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Faced the same issue on PHP 7.4. Found this fix on GitHub.

So if you're using Twig 1, upgrade it at least to v1.43.0.

If you're using Twig 2, upgrade it at least to v2.10.0. (my case - I had v2.7.4 in the project).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...