terminal42 / contao-conditionalformfields

Display form fields conditionally in Contao Open Source CMS
MIT License
18 stars 11 forks source link

Problem with "in_array" conditions in 3.0.x #71

Closed con2net closed 1 year ago

con2net commented 1 year ago

After updating to C4.13.15, PHP8.1 and 3.0.x of contao-conditionalformfields, forms with in_array conditions crash when trying to send: e.g. condition on fieldset: (in_array('demo',interests)) || (in_array('quote',interests))

Log: [2023-01-16T15:40:44.412178+01:00] request.INFO: Matched route "tl_page.79". {"route":"tl_page.79","route_parameters":{"_token_check":true,"_controller":"Contao\\FrontendIndex::renderPage","_scope":"frontend","_locale":"de","_format":"html","_canonical_route":"tl_page.79","parameters":"","pageModel":{"Contao\\PageModel":[]},"_route":"tl_page.79","_route_object":{"Contao\\CoreBundle\\Routing\\Page\\PageRoute":[]}},"request_uri":"https://spielwiese.example.de/de/kontakt.html","method":"POST"} [] [2023-01-16T15:40:44.431927+01:00] security.INFO: Populated the TokenStorage with an anonymous Token. [] [] [2023-01-16T15:40:44.664992+01:00] request.CRITICAL: Uncaught PHP Exception TypeError: "in_array(): Argument #2 ($haystack) must be of type array, string given" at /var/www/clients/client1/web8/web/vendor/symfony/expression-language/ExpressionFunction.php line 101 {"exception":"[object] (TypeError(code: 0): in_array(): Argument #2 ($haystack) must be of type array, string given at /var/www/clients/client1/web8/web/vendor/symfony/expression-language/ExpressionFunction.php:101)"} []

If I remove the condition, the form works "normally".

takhadnotor commented 1 year ago

I have the same issue here with contao-conditionalformfields 2.3.4, Contao 4.13.14 and PHP 8.0.25. The configuration had already worked fine. In late December I updated Contao, some extensions and PHP.

aschempp commented 1 year ago

looks like interests is not an array, what type of field is this?

con2net commented 1 year ago

interests is a checkbox menu with 3 option values. This setting/form worked perfectly before the update.

con2net commented 1 year ago

After installing new version 3.0.8, the error disappeared ;-) Thanks a lot!