1

I have a WordPress theme based on twig templates. Now I upgrade PHP version 7.2 to 7.4. After upgrading this version I am getting issues with the HTML tag. Space gets removed from the attribute.

<labelclass="in-label in-label"data-toggle="tooltip" data-placement="top" title="Commercial" for="cf47rs_cf47rs-property-filter-8_property_type_0">Commercial
            </labelclass="in-label>

When I change the PHP version to old one then this issue gets fixed. How i can fix this issue

Thanks

Addy
  • 998
  • 4
  • 12
  • 36
  • Does this answer your question? [Twig problem with php 7.4 in write variable](https://stackoverflow.com/questions/59248533/twig-problem-with-php-7-4-in-write-variable) – DarkBee Aug 04 '21 at 09:58
  • No. Did not work – Addy Aug 04 '21 at 12:10
  • Well. What have you tried then? Did you update the twig version to start with? – DarkBee Aug 04 '21 at 12:13
  • No. I tried this solution: 'Find in file Lexer.php function lexData line 163 change:' – Addy Aug 04 '21 at 12:16
  • I am not sure about how I can update the twig version because all files are loading from a plugin with vendor folder. – Addy Aug 04 '21 at 12:17
  • Strange that updating `lexData` doesn't work. Worked instantly here. Did you clean your cache folder before trying? In order to update the twig version you should be able to update the composer file – DarkBee Aug 04 '21 at 12:28
  • So your function now looks like [this](https://github.com/twigphp/Twig/pull/3004/commits/1fb0f9701d8443083495cd2645e8a0c45d54c34d) right? – DarkBee Aug 04 '21 at 12:33

1 Answers1

0

Just update to the latest twig version, latest master versions have been fixed. See the change on GitHub.

I am using version 1 and the issue has gone after updating twig vendor with composer.

$ composer update twig/twig

Package operations: 1 install, 1 update, 0 removals
  - Installing symfony/polyfill-ctype (v1.23.0): Loading from cache
  - Updating twig/twig (v1.35.3 => v1.43.1): Loading from cache
sglessard
  • 3,097
  • 2
  • 27
  • 31