terminal42 / contao-conditionalformfields

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

Error with MP_Forms #31

Closed zonky2 closed 5 years ago

zonky2 commented 5 years ago
Type error: Argument 4 passed to ConditionalFormFields::loadFormField() must be an instance of Form, instance of Contao\Form given, called in /kunden/123/webseiten/contao4_xyz.de/vendor/terminal42/contao-mp_forms/MPFormsFormManager.php on line 416

Workaround https://github.com/terminal42/contao-conditionalformfields/blob/master/ConditionalFormFields.php#L95-L123

-    public function loadFormField($objWidget, $formId, $arrForm, \Form $form)
    {
+    public function loadFormField($objWidget, $formId, $arrForm, \Contao\Form $form)
    {
...
-    public function validateFormField($objWidget, $formId, $arrForm, \Form $form)
    {
+    public function validateFormField($objWidget, $formId, $arrForm, \Contao\Form $form)
    {
Toflar commented 5 years ago

In what contao version does that happen?

zonky2 commented 5 years ago

sorry: Version 4.4.38

richardhj commented 5 years ago

~Can you install hotfix/2.2.3 as 2.2.3 of mp_forms and give feedback? Thank you.~

Toflar commented 5 years ago

I guess I‘d rather fix the type hints :)

richardhj commented 5 years ago

I was thinking the type hint \Form $form is very usual for legacy code 🤔

Toflar commented 5 years ago

I wonder why this error happens anyway as Form should be aliased to \Contao\Form🤔

richardhj commented 5 years ago

Since Contao 4.5 or so. Before that, the autoloading is a mystery.

aschempp commented 5 years ago

It might be related to PHP 7.3, as that is more strict on these things afaik?