pkp/pkp-lib#12232 Fix null issueId and null suffix pattern TypeErrors in mintPublicationDoi#5529
Open
MrRob100 wants to merge 1 commit into
Open
pkp/pkp-lib#12232 Fix null issueId and null suffix pattern TypeErrors in mintPublicationDoi#5529MrRob100 wants to merge 1 commit into
MrRob100 wants to merge 1 commit into
Conversation
… in mintPublicationDoi Two regressions introduced by pkp#5170 (shipped in 3.4.0-10): 1. Repo::issue()->get() was called unconditionally with the publication's issueId, which is null for unscheduled submissions at copyediting stage. Guard issueId before calling get() to avoid the TypeError. 2. PubIdPlugin::suffixHasIssuePattern() declares string $pubIdSuffix but getPubIdSuffixPattern() returns null when the custom Submissions pattern field has never been saved. Extract the pattern first, and throw a DoiException (rather than an uncaught TypeError) when it is empty so the editorial workflow continues uninterrupted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two
TypeErrorregressions inclasses/doi/Repository.phpintroduced by #5170 (shipped in 3.4.0-10), which addressed pkp/pkp-lib#12005.Both errors surface as HTTP 500 responses and affect journals using Custom Pattern DOI suffix type with Automatic DOI Assignment set to Upon reaching the copyediting stage.
Bug 1 — null
issueIdcausesTypeErrorinmintPublicationDoi(pkp/pkp-lib#12232)When a submission reaches copyediting without being assigned to an issue,
$publication->getData('issueId')returnsnull. After #5170 restructured the issue guard,Repo::issue()->get()is now called unconditionally, but its signature requiresint $id— passingnullthrows:Fix: Extract
$issueIdfirst and only callRepo::issue()->get()when non-null.Bug 2 — null suffix pattern causes
TypeErrorinsuffixHasIssuePattern()When the Custom Pattern DOI format is selected but the Submissions pattern field is left blank,
getPubIdSuffixPattern()returnsnull.PubIdPlugin::suffixHasIssuePattern()declaresstring $pubIdSuffix, so passingnullthrows:Fix: Extract the suffix pattern before calling
suffixHasIssuePattern()and throw aDoiExceptionwhen empty, so the editorial workflow continues cleanly rather than producing an unhandled 500.Related
Test plan
DoiExceptioninstead of 500%j-%a(no issue tokens), submission at copyediting with no issue assigned → confirm DOI mints without error%v/%i/%Y, submission with no issue → confirm existingPUBLICATION_MISSING_ISSUEDoiException still raised🤖 Generated with Claude Code