77845[BUGFIX] Avoid repeated e-mail content generation in FluidEmail
Commit message
Review
-
Code review CR +2 Done
- Stefan Bürk +2
- Markus Klein +1
- Christian Kuhn +1
-
Verified V +2 Done
- Stefan Bürk +2
- Christian Kuhn +1
- core-ci +1 CI
Issues 1
Files 3
Review log 3038
Show 1113 earlier messages
-
Markus Klein uploaded patch set 1 02/13/23, 20:07
-
core-ci voted on patch set 1 V +1 02/13/23, 20:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37662
-
Josef Glatz commented on patch set 1 02/13/23, 20:22
-
Markus Klein commented on patch set 2
V +102/13/23, 20:35Published edit on patch set 1. -
Markus Klein commented on patch set 2 02/13/23, 20:36
FluidEmail.php:166ReplyDone -
Josef Glatz voted on patch set 2 CR +1 02/13/23, 20:37
-
core-ci voted on patch set 2 V +1 02/13/23, 20:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/37663
-
Josef Glatz voted on patch set 2 V +1 02/14/23, 12:11
-
Thomas Hohn voted on patch set 2 CR +1 02/15/23, 19:45
-
Stefan Bürk commented on patch set 2 CR -1 02/16/23, 19:44
See comment. The solution breaks the enforcement on other methods.FluidEmail.php:169This is not a good solution. This will break the `$forceBodyGeneration` flag in `getTextBody()` and `getHtmlBdy()`, making it useless. -
Markus Klein commented on patch set 2 02/17/23, 07:26
FluidEmail.php:169ReplyI don't understand why this should break it? Besides that the bool parameter is nowhere used in Core. -
Markus Klein commented on patch set 2 02/17/23, 07:27
FluidEmail.php:169ReplyIt's actually much worse that a method subject to check validity actually mutates state! -
Stefan Bürk commented on patch set 2 02/23/23, 12:11
FluidEmail.php:169ReplyFluidMail is not just a core internal thing, and the force parameter is a public argument for a public method on a public api class. E.h. if variables are assigned, the body retrieved, the variable changed, and the body retrieved again it would not use the new variable due not rerendering the template. Even if $forceBodyGeneration = true is given to getTextBody() or getHtmlBody(). ```php $email = GeneralUtility::makeInstance(FluidEmail::class); // ... setting to, from, subject etc $email ->format(FORMAT_BOTH) ->assign('some-variable', 'Tomato and TypoScript'); $text1 = $email->getTextBody(); $email->assign('some-variable', 'Tomato and TypoScript CHANGED') $text2 = $email->getTextBody(true); // $text2 would be the same as $text1, not using the changed variable // because $forceBodyGeneration is now meaningless due the added // condition ``` Beside this, recenently saw people reusing the mail instance and just changing values. I know, bad habit but they do it. The introduced check / condition in `generateTemplatedBody()` has 2 flaws: * preventing regeneration template * not rendering a format if the other is set. ```php $email = GeneralUtility::makeInstance(FluidEmail::class); $email->format(FORMAT_BOTH); $text = $email->getTextBody(); $html = $email->getHtmlBody(); ``` The condition says, that if text OR html is set, no generation is done. Therefore the second format would not be rendered. The check should be extended at least, that it only checks if the value (parent get call) for the specified $format is not null and than return. Albit still leaving the $forceBodyGeneration broken. And the force argument should be handed to the generated method, to avoid that chack if argument is true.
-
Markus Klein commented on patch set 2 02/23/23, 13:52
FluidEmail.php:169ReplyThanks for the analysis. Well, that's a chicken/egg now. Either double-Fluid-rendering is dead, or external content is dead. ;-) The true culprit is line 124, the side-effect of changing the message in an "assertion"-method. -
Markus Klein uploaded patch set 3
CR +1V +103/24/23, 19:43 -
Markus Klein voted on patch set 3 CR 0 03/24/23, 19:49
-
Markus Klein uploaded patch set 4 03/24/23, 19:54
-
core-ci voted on patch set 3 V -1 03/24/23, 20:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39589
-
Markus Klein uploaded patch set 5 03/24/23, 20:08
-
core-ci voted on patch set 4 V -1 03/24/23, 20:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39592
-
core-ci voted on patch set 5 V +1 03/24/23, 20:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39595
-
Stefan Bürk voted on patch set 5 CR +1 03/24/23, 22:31
-
Stefan Bürk commented on patch set 6
CR +1V +103/24/23, 22:33Published edit on patch set 5. -
Stefan Bürk commented on patch set 6 CR -1 03/24/23, 22:36
I try to add some tests for this ... -
core-ci voted on patch set 6 V +1 03/24/23, 22:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39613
-
Stefan Bürk commented on patch set 6 04/24/23, 03:22
Tried to come up with some tests. It revealed, that this is not really working out. @Markus Klein Could we have a slack call the next days about this ? -
Stefan Bürk uploaded patch set 7
CR -1V +104/24/23, 08:56 -
Stefan Bürk commented on patch set 7 04/24/23, 08:57
Reply
Pushed tests with patchset 7 (should faild). Will discuss this with Markus, and push a change which will work along with these tests later. -
Stefan Bürk voted on patch set 7 CR -1 04/24/23, 08:57
-
core-ci voted on patch set 7 V -1 04/24/23, 09:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41129
-
Stefan Bürk uploaded patch set 8
CR -1V -104/24/23, 13:46 -
core-ci voted on patch set 8 V +1 04/24/23, 13:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41168
-
Markus Klein voted on patch set 8 CR +1 04/24/23, 14:00
-
Stefan Bürk voted on patch set 8 V +1 CR +1 04/24/23, 14:13
-
Christian Kuhn voted on patch set 8 V +1 CR +1 04/24/23, 18:15
-
Stefan Bürk voted on patch set 8 V +2 CR +2 04/24/23, 18:18
-
Stefan Bürk merged patch set 9 04/24/23, 18:18
FluidEmail.php:166