Skip to content

Conversation

@netmas
Copy link

@netmas netmas commented Apr 18, 2024

This modification verifies that the $context is of type Journal.

This fixes this error:

[17-Apr-2024 14:09:43 America/Argentina/Cordoba] Slim Application Error:
Type: TypeError
Message: APP\plugins\generic\orcidProfile\mailables\OrcidCollectAuthorId::__construct(): Argument #1 ($context) must be of type APP\journal\Journal, APP\server\Server given, called in /home/paideias/preprints.latarxiv.org/plugins/generic/orcidProfile/OrcidProfilePlugin.php on line 898
File: /home/paideias/preprints.latarxiv.org/plugins/generic/orcidProfile/mailables/OrcidCollectAuthorId.php
Line: 38
Trace: #0 /home/paideias/preprints.latarxiv.org/plugins/generic/orcidProfile/OrcidProfilePlugin.php(898): APP\plugins\generic\orcidProfile\mailables\OrcidCollectAuthorId->__construct()
#1 /home/paideias/preprints.latarxiv.org/plugins/generic/orcidProfile/OrcidProfilePlugin.php(862): APP\plugins\generic\orcidProfile\OrcidProfilePlugin->sendAuthorMail()
#2 [internal function]: APP\plugins\generic\orcidProfile\OrcidProfilePlugin->handleAuthorFormExecute()

@asmecher
Copy link
Member

@ewhanson, can you tackle this one? I suppose the issue was probably encountered on stable-3_4_0, as stable-3_3_0 doesn't have typehints.

@ewhanson ewhanson self-assigned this Apr 18, 2024
@ewhanson
Copy link

Hey @netmas, thanks for finding this and submitting a PR!

I think in this case, rather than an instanceof check, it would be better to make the expected type for the mailables the parent Context class rather than a journal. This should be updated both here:

public function __construct(Journal $context, Submission $submission, string $oauthUrl)
and here:
public function __construct(Journal|Server $context, Submission $submission, string $oauthUrl)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants