92811[TASK] Provide context parameters to post-process the field value
Commit message
Review
-
Code review CR +2 Done
- Garvin Hicking +2
- Georg Ringer +1
- Anja Leichsenring +1
-
Verified V +2 Done
- Garvin Hicking +2
- Georg Ringer +1
- Anja Leichsenring +1
- core-ci +1 CI
Issues 1
Files 1
Review log 1416
-
Xavier Perseguers uploaded patch set 1 02/12/26, 09:40
-
core-ci voted on patch set 1 V +1 02/12/26, 09:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95697
-
Georg Ringer voted on patch set 1 CR +1 V +1 02/12/26, 10:44
-
Garvin Hicking commented on patch set 1 CR -1 02/12/26, 12:10
Please check out: ``` ['t3lib/class.t3lib_befunc.php']['preProcessValue'] ``` That one creates a reference Object: $referenceObject = new \stdClass(); $referenceObject->table = $table; $referenceObject->fieldName = $col; $referenceObject->uid = $uid; $referenceObject->value = &$value; You could evaluate that also on the "postProcess" by capturing it? Anyways, I would suggest that if we do pass further meta information, we should use the same object there and not invent new keys. However passing the object then instead of $null could be considered a breaking change. So we might put the reference object into the params array then. If this gets merged please remember to provide a Documentation PR / issue, because otherwise the new fields won't find their way into the docs as there is no feature/important rst. I am not sure we should introduce this to 12.4 tbh. Who knows what people do with that $params array (foreaching the keys, forwarding them to an API that does not expect new keys, etc.) which could suddenly fail. That is too dangerous IMO. Maybe due to this we should even make this main-only and actually add an Important.rst and consider it only soft-breaking. -
Xavier Perseguers commented on patch set 1 02/12/26, 12:54
Reply
To make it clear, if I get it right: - You suggest to add the $referenceObject as parameter instead of adding the 3 suggested parameters, right? 1. That's possible but it means we will end up having two references to the $value, and that second introduced by that change will mean it may be changed from that hook, I find it dangerous. 2. Ideally we should have the same reference object in both hooks, that wasn't done like that and we cannot change that Regarding: >I am not sure we should introduce this to 12.4 tbh [...] At this stage that means that we cannot change the hook either. No single developer would blindly "foreach-ing" onto parameters and passing them to some API, that would be insane! TYPO3 from the very beginning always told that hooks were to be adapted whenever needed to fit the requirements of real-life use cases and to promote that over XCLASSing stuff. If you have another better idea, I'm fine, but adding some parameters (whichever they are) to a hook has never been seen as problematic. So I don't see this as "too dangerous". If you feel it should go only to v13 and main, I can live with that, as I can just backport the patch for myself. -
Garvin Hicking commented on patch set 1 02/12/26, 20:30
Reply
> At this stage that means that we cannot change the hook either. No single developer would blindly "foreach-ing" onto parameters and passing them to some API, that would be insane! That's just an assumption and not a guarantee, which a maintainer needs to weigh. For stability, I would say at the EOL of v12 this is not a change we can make. So: The only thing I want to block here is that we introduce a second set of "metadata", when we already have one. If it's already "kind-of-breaking-change", I think we should even use that object instead of $null, and NOT add it as a 3rd parameter in $parameters. I would feel better with merging this at best to v13, but if any other merger feels good to do that in v12, it's their responsibility and I will of course not block it. As you can see the `$referenceObject` is not used outside of the first hook call. So it's just a simple DTO, and what would you expect by altering that reference object in a userFunc, as it's not evaluated anyhwere in the Core code. And if one hook user func alters that object (I would not know a reason), it would proably even be good to have that change reflected in subsequent calls to other hook consumers. -
Xavier Perseguers commented on patch set 1 02/13/26, 13:46
Reply
Regarding `$referenceObject` what I mean is that it is done like that: ``` $referenceObject = new \stdClass(); $referenceObject->table = $table; $referenceObject->fieldName = $col; $referenceObject->uid = $uid; $referenceObject->value = &$value; ``` with `value` being a reference. and we already have that parameter, that's a bit redundant. But I agree the reference makes no problem since the return value is used in that context, whereas the "pre" hook is void. In the end I don't really care, just tell me how you'd prefer I alter that patch so that you give +2 in addition to Georg and I'll be happy. And targeting v13 and main is totally fine for me as said already. -
Garvin Hicking uploaded patch set 2
CR +1V +102/13/26, 17:37 -
core-ci voted on patch set 2 V +1 02/13/26, 17:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95841
-
Garvin Hicking commented on patch set 2 CR +1 V +1 02/13/26, 17:47
Reply
Let me know if this works for you. @georg.ringer@gmail.com I let you decide if you want it for 12.4. With this way I could live with it. -
Anja Leichsenring voted on patch set 2 CR +1 V +1 02/13/26, 19:17
-
Georg Ringer commented on patch set 2 CR +1 V +1 02/13/26, 20:02
@garvin@hick.ing lets stay with 13.4, wanna merge? -
Garvin Hicking voted on patch set 2 CR +2 V +2 02/13/26, 20:50
-
Garvin Hicking merged patch set 3 02/13/26, 21:04
-
Xavier Perseguers commented on patch set 3 02/14/26, 17:13
Works perfectly as well. Many thanks to all for taking care. -
Garvin Hicking commented on patch set 3 02/14/26, 19:01
Reply
Thanks for this feedback, I'm happy :)