pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
306 stars 445 forks source link

(OJS-3.4rc3) On click Add and edit templates (email) HTTP ERROR 500 appeared. #8975

Closed shantanu198713 closed 1 year ago

shantanu198713 commented 1 year ago

OJS-3.4rc3 PHP-8.1.13

I want to edit or view the email template, but after clicking on 'Add & Edit Template' HTTP ERROR 500 appeared.

email error 500 error

Error log

`[10-May-2023 07:01:08 UTC] Exception: Plugin referral expected to inherit from ReferralPlugin, actual type NULL in F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php:202 Stack trace:

0 F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php(218): PKP\plugins\PluginRegistry::_instantiatePlugin('generic', 'referral', 'ReferralPlugin')

1 F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php(111): PKP\plugins\PluginRegistry::_loadFromDatabase('generic', NULL)

2 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\Dispatcher.php(155): PKP\plugins\PluginRegistry::loadCategory('generic', true)

3 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\PKPApplication.php(372): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))

4 F:\wamp64\www\ojs34rc3\index.php(21): PKP\core\PKPApplication->execute()

5 {main}

[10-May-2023 07:01:08 UTC] Exception: Plugin coins expected to inherit from CoinsPlugin, actual type NULL in F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php:202 Stack trace:

0 F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php(218): PKP\plugins\PluginRegistry::_instantiatePlugin('generic', 'coins', 'CoinsPlugin')

1 F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php(111): PKP\plugins\PluginRegistry::_loadFromDatabase('generic', NULL)

2 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\Dispatcher.php(155): PKP\plugins\PluginRegistry::loadCategory('generic', true)

3 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\PKPApplication.php(372): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))

4 F:\wamp64\www\ojs34rc3\index.php(21): PKP\core\PKPApplication->execute()

5 {main}

[10-May-2023 07:01:08 UTC] Exception: Plugin crossrefReferenceLinking expected to inherit from CrossrefReferenceLinkingPlugin, actual type NULL in F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php:202 Stack trace:

0 F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php(218): PKP\plugins\PluginRegistry::_instantiatePlugin('generic', 'crossrefReferen...', 'CrossrefReferen...')

1 F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php(111): PKP\plugins\PluginRegistry::_loadFromDatabase('generic', NULL)

2 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\Dispatcher.php(155): PKP\plugins\PluginRegistry::loadCategory('generic', true)

3 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\PKPApplication.php(372): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))

4 F:\wamp64\www\ojs34rc3\index.php(21): PKP\core\PKPApplication->execute()

5 {main}

[10-May-2023 07:01:08 UTC] Exception: Plugin citations expected to inherit from CitationsPlugin, actual type NULL in F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php:202 Stack trace:

0 F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php(218): PKP\plugins\PluginRegistry::_instantiatePlugin('generic', 'citations', 'CitationsPlugin')

1 F:\wamp64\www\ojs34rc3\lib\pkp\classes\plugins\PluginRegistry.php(111): PKP\plugins\PluginRegistry::_loadFromDatabase('generic', NULL)

2 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\Dispatcher.php(155): PKP\plugins\PluginRegistry::loadCategory('generic', true)

3 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\PKPApplication.php(372): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))

4 F:\wamp64\www\ojs34rc3\index.php(21): PKP\core\PKPApplication->execute()

5 {main}

[10-May-2023 07:01:10 UTC] PHP Fatal error: Uncaught Error: Call to undefined method ReflectionUnionType::getName() in F:\wamp64\www\ojs34rc3\lib\pkp\classes\mail\Mailable.php:452 Stack trace:

0 F:\wamp64\www\ojs34rc3\plugins\generic\orcidProfile\mailables\OrcidRequestAuthorAuthorization.php(47): PKP\mail\Mailable::getDataDescriptions()

1 F:\wamp64\www\ojs34rc3\lib\pkp\classes\mail\Repository.php(85): APP\plugins\generic\orcidProfile\mailables\OrcidRequestAuthorAuthorization::getDataDescriptions()

2 F:\wamp64\www\ojs34rc3\lib\pkp\pages\management\ManagementHandler.php(509): PKP\mail\Repository->summarizeMailable('APP\plugins\gen...')

3 [internal function]: PKP\pages\management\ManagementHandler->PKP\pages\management{closure}('APP\plugins\gen...', 59)

4 F:\wamp64\www\ojs34rc3\lib\pkp\lib\vendor\laravel\framework\src\Illuminate\Collections\Arr.php(560): array_map(Object(Closure), Array, Array)

5 F:\wamp64\www\ojs34rc3\lib\pkp\lib\vendor\laravel\framework\src\Illuminate\Collections\Collection.php(768): Illuminate\Support\Arr::map(Array, Object(Closure))

6 F:\wamp64\www\ojs34rc3\lib\pkp\pages\management\ManagementHandler.php(509): Illuminate\Support\Collection->map(Object(Closure))

7 F:\wamp64\www\ojs34rc3\lib\pkp\pages\management\ManagementHandler.php(95): PKP\pages\management\ManagementHandler->manageEmails(Array, Object(APP\core\Request))

8 [internal function]: PKP\pages\management\ManagementHandler->settings(Array, Object(APP\core\Request))

9 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\PKPRouter.php(333): call_user_func(Array, Array, Object(APP\core\Request))

10 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\PKPPageRouter.php(278): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array, false)

11 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\Dispatcher.php(165): PKP\core\PKPPageRouter->route(Object(APP\core\Request))

12 F:\wamp64\www\ojs34rc3\lib\pkp\classes\core\PKPApplication.php(372): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))

13 F:\wamp64\www\ojs34rc3\index.php(21): PKP\core\PKPApplication->execute()

14 {main}

thrown in F:\wamp64\www\ojs34rc3\lib\pkp\classes\mail\Mailable.php on line 452`

jonasraoni commented 1 year ago

Hi @shantanu198713,

Looks like you're using plugins which haven't been prepared to work under OJS 3.4 (or a newer PHP version). You'll have to disable them until updates are released (if you're unable to disable them, you can move them physically from the plugins folder).

Here you can see the list of what's on our radar/what has been updated already: https://github.com/pkp/pkp-lib/issues/8338

In case you got other external plugins (not maintained by us), you'll have to get in touch with the plugin creator.

jonasraoni commented 1 year ago

I searched fast and perhaps some plugins are from OJS 2 and probably don't even exist anymore (e.g. Referral Plugin).

jonasraoni commented 1 year ago

But those are just warnings, the real error needs to be handled by us:

PHP Fatal error: Uncaught Error: Call to undefined method ReflectionUnionType::getName() in F:\wamp64\www\ojs34rc3\lib\pkp\classes\mail\Mailable.php:452
shantanu198713 commented 1 year ago

Hi @jonasraoni

Thank you for your response. I've got the plugin (ORCID Profile Plugin), And after disabling that now the email templates are accessible. I hope ORCID Profile Plugin will soon be compatible with PHP-8.0 and above.

jonasraoni commented 1 year ago

I think this plugin is already compatible, the problem is on the code to handle email templates at OJS.

This error is tough to find, it's probably just affecting the Orcid plugin :)

shantanu198713 commented 1 year ago

Can you provide me updated ORCID plugin for installation and testing? Currently, I am using the ORCID Profile version [1.3.4.3].

jonasraoni commented 1 year ago

This is supposed to work with 3.4 (but you just found an unexpected bug related to editing the email templates), see: https://github.com/pkp/orcidProfile/releases/tag/v1_3_4-3

jonasraoni commented 1 year ago

@Vitaliy-1, I think you're better suited to review the PRs:

Vitaliy-1 commented 1 year ago

Thanks, @jonasraoni! It's a tricky issue, I left a comment on how we can bypass limitation with union types. Unfortunately, Mailables weren't designed to be constructed with ambiguity in type declarations.