Issue Bug Closed

#100281Passing number-only properties to form field ViewHelpers causes exception

Andreas Nedbal 03/24/23, 08:55 updated 07/09/24, 12:55

Description

We’re currently upgrading Powermail to version 12 and encountered an issue with form fields if the property passed to it is a int instead of (expectedly) a string. This worked in versions before 12.

Here’s the template causing the issue (this repository is not the v12 version yet, but the template is identical)
https://github.com/einpraegsam/powermail/blob/develop/Resources/Private/Partials/Output/Search.html#L33

This triggers following exception in AbstractFormFieldViewHelper

explode(): Argument #2 ($string) must be of type string, int given

In regards of typing, this behaviour makes sense and I’d personally even say that number-only form properties are an edge case, but it still massively breaks this part of the extension.

Explicitly typecasting the usages of the property argument in AbstractFormFieldViewHelper solves this.

Reviews 2

History 26

  1. Gerrit Code Review pushed patch set 1 for main to change 78294 status New Under Review 03/28/23, 07:37

  2. Gerrit Code Review pushed patch set 2 for main to change 78294 04/13/23, 06:43

  3. Gerrit Code Review pushed patch set 3 for main to change 78294 04/13/23, 07:56

  4. Gerrit Code Review pushed patch set 1 for 11.5 to change 78573 04/13/23, 08:06

  5. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % 04/13/23, 08:10

    Applied in changeset commit:9a6fc9a6f60371e7447d30b83e009a96a1fd7ea8.

  6. Benni Mack changed status Resolved Closed 07/09/24, 12:55