- Issue created by @6RUN0
- πΊπΈUnited States pianomansam
@6run0 thank you for the bug report and issue fork with a potential fix. In order for it to be considered, please add tests that demonstrate both the bug and the fix.
- π΅πΉPortugal tiage
Hey yall,
Iβm getting an issue when using [3519448-tokenor-module-fails] to send Twig-based mail templates via Symfony Mailer: the HTML comments in my templates are being stripped out entirely.What Iβm seeing
Any HTML comment of the form<!--[if mso | IE]>β¦<![endif]-->
is picked up by the token detector and removed from the rendered message. For example, a snippet like:<tr> <td><!--[if mso | IE]><table><tr><td><![endif]--> <div> <table> <tbody> <tr> ...more tables... </tr> </tbody> </table> </div> <!--[if mso | IE]></td></tr></table><![endif]--></td> </tr>
is ending up as:
<tr> <td><!--><table><tr><td><![endif]--> <div> <table> <tbody> <tr> ...more tables... </tr> </tbody> </table> </div> <!--></td></tr></table><![endif]--></td> </tr>
Where's the problem
I think the problem lies in the "src/TokenOrTokensPreAlter.php" specifically in "tokensPreAlter" function as shown bellow:... preg_match_all("/\[[^\[\]]+\]/", $text, $matches); if (empty($matches)) { return; } foreach (reset($matches) as $match) { if (strpos($match, '|') !== FALSE) { $match_clean = substr(substr($match, 1), 0, -1); $sub_tokens = explode('|', $match_clean); ...
preg_match_all("/\[[^\[\]]+\]/", $text, $matches);
identifies them as tokensstrpos($match, '|') !== FALSE
identifies them as a token_or
Thanks,
TM - πΊπΈUnited States pianomansam
@tiage thanks for the feedback on this issue. Feel free to create a separate issue branch and come up with a solution.
- First commit to issue fork.
- π΅πΉPortugal lolgm
Iβve added tests to demonstrate the problem.
Two functional tests inTokenOrWebformFunctionalBrokenTest
were updated to reflect the expected behavior. -
pianomansam β
committed c6a15bd6 on 2.x authored by
lolgm β
Issue #3519448 by 6run0, lolgm: token_or module fails without explicit '...
-
pianomansam β
committed c6a15bd6 on 2.x authored by
lolgm β
- πΊπΈUnited States pianomansam
@lolgm thanks for the tests. With those passing, I've gone ahead and merged this into dev.