smartinkc / Multilingual

MIT License
4 stars 13 forks source link

Unable to enable module "Multilingual" #52

Open mattvh2 opened 3 years ago

mattvh2 commented 3 years ago

Hi everybody,

i am in search of help for a problem that we are facing since updating our PHP version and the REDCap version. Ever since, we have been unable to re-enable the multilingual plugin. The error message we are getting is "Declaration of Multilingual::getMetaData($project_id,$form = null) must be compatible with ExternalModules\AbstractExternalModule::getMetadata() File \Multilingual.php Line:499" The multilingual plugin is the latest version, 1.9.8, PHP is 8.0.11 and REDCap 10.9.3 Any pointers would be very much appreciated..

cannebergerouge commented 3 years ago

same problem here also seem related to the getMetadata() function not being instantiated like before into.

./redcap_v11.2.2/ExternalModules/classes/AbstractExternalModule.php

as compared to v10.6.2

cannebergerouge commented 3 years ago

I have fixed the problem by commenting lines 275-277 and 287-289 in ./redcap_v11.2.2/ExternalModules/classes/AbstractExternalModule.php

Namely theses two functions:

    //function getMetadata(){
    //      return $this->__call(__FUNCTION__, func_get_args());
    //}

    //function getData(){
    //      return $this->__call(__FUNCTION__, func_get_args());
    //}

My reasoning was that this comment : /**

Seem to indicate theses function instantiation where there only for backward compatibility of very old version. But now it seem this create greater problem for newer version. So I tried to just comment them and it worked.

oslcmike commented 2 years ago

I encountered this issue too. We are using REDCap 12.2.1, PHP 8.1.2. and Multilingual 1.9.8. The workaround posted by cannebergerouge worked... thanks cannebergerouge! Long-term this isn't a great fix though because we'll need to apply it after every REDCap upgrade. Are there any plans to release a new version of Multilingual with a permanent fix?

trottaleonardo commented 2 years ago

I believe I was able to fix the compatibility problems of this module with PHP 8.X by changing some function names (..../modules/multilingual_v1.9.8/Multilingual.php):

line 486: public function getData($project_id , $record){ to public function getData($project_id = null, $record = null){ line 499: public function getMetaData($project_id, $form = null){ to public function getMetaData($project_id = null, $form = null){

No more error messages, and it seems to work for now (tested both on survey and data entry form).

We want to upgrade to php 8.x as well, but many users are still relying on this module (production status).

Tested on a local installation of REDCap v12.4.16.