Review main Merged

88942[BUGFIX] Fix extbase allowProperty() not allowing int keys

Garvin Hicking CR +2 V +2 Easy +1 −1 updated 04/10/25, 05:56

Commit message

With #101292 the introduced types change the signature
of PropertyMappingConfiguration->allowProperties() to:

```
  public function allowProperties(string ...$propertyNames): self
```

In case an extbase f:form though submits this:

```
<input type="hidden"
       name="tx_some_model[__trustedProperties]"
       value="{&quot;item&quot;:{&quot;title&quot;:1,&quot;
         categories&quot;:[1,1,1],&quot;date&quot;:1},
         &quot;submit&quot;:1}9919...">
```

Here the `[1,1,1]` gets passed to `allowProperties()` as int values,
leading to a fatal PHP TypeError.

This means the signature also needs to accept at least ints,
which is performed with this patch.

Note that currently, there are no functional extbase tests in place
that cover most of these type changes affecting f:form handling.
Other issues may also show up with "live" extensions and need
evaluation.

The proof this is broken and can be fixed is available in
patch #106493.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Georg Ringer +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 3

Files 1

Review log 1417

  1. Garvin Hicking uploaded patch set 1 04/03/25, 18:38

  2. Garvin Hicking updated the commit message in patch set 2 04/03/25, 18:38

  3. Garvin Hicking commented on patch set 2 04/03/25, 18:40

    Please review, maybe with this in mind other places could need adoption stemming from the type changes? Test coverage is really bad sadly.
  4. Garvin Hicking updated the commit message in patch set 3 04/03/25, 18:41

  5. core-ci voted on patch set 1 V +1 04/03/25, 18:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76961

  6. core-ci voted on patch set 2 V +1 04/03/25, 18:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76962

  7. core-ci voted on patch set 3 V +1 04/03/25, 18:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/76963

  8. Georg Ringer voted on patch set 3 CR +1 V +1 04/03/25, 19:13

  9. Stefan Bürk commented on patch set 3 CR -1 04/04/25, 08:18

    Need to check something ...
  10. Stefan Bürk commented on patch set 3 CR -2 04/04/25, 11:26

    Reply

    Talked with Garvin about it. He will do some more investigation as I think that the issue might not be the method argument type but lies in the whole mapping/property handling for arrays in this case at all (logical). Need to have a closer eye on this part. Putting -2 on this now to ensure that I review it again after the investigation and eventually changed approach. (Aligned with Garvin on that).
  11. Garvin Hicking commented on patch set 3 04/06/25, 18:07

    Reply

    I created an example extesnion to showcase that the behavior of trustedProperties since at least TYPO3v11-14 yielfed: https://github.com/garvinhicking/typo3-extbase-frontend "propertyWithArrayKeys:[1,1,1,1]" and nit what you might expect "propertyWithArrayKeys:1" So I would argue the assumption that only stringValues valid and not intValues does not apply, and at least short-term we should use the bugfix as above. Evaluating whether these array keys are "sane" should be done in a follow-up, together with more tests covering this in my oppinion.
  12. Stefan Bürk commented on patch set 3 CR 0 04/09/25, 11:17

    Removing -2. The thing wih the array should be investigated separatly, I guess. However, I'm not sure if the change is complete. Other methods in that class also deals with string keys on arrays, and all the annotations are `non-empty-string` ... but array integer keyes are always converted to integer as long as no string keys are added.
  13. Garvin Hicking commented on patch set 3 04/09/25, 12:32

    Reply

    I agree that the patch this stems might reveal other issues as well. But this will then need special attention and more follow-ups I believe. I would opt to merge this patch as-is to carry on and unfix the current bug with trustedProperties. (I would love feedback of @git@alexanderschnitzler.de though :-) )
  14. Garvin Hicking commented on patch set 3 04/09/25, 12:32

    Reply

    Done

    Reply

    Done
  15. Christian Kuhn voted on patch set 3 CR +1 V +1 04/09/25, 12:34

  16. Garvin Hicking voted on patch set 3 CR +2 V +2 04/10/25, 05:56

  17. Garvin Hicking merged patch set 4 04/10/25, 05:56