Reviewer Certificate Plugin for OJS 3.4

:graduation_cap: Reviewer Certificate Plugin for OJS 3.4 - Recognize Your Peer Reviewers!

Hello OJS Community! :waving_hand:

I’m excited to share the Reviewer Certificate Plugin - a new tool that helps journals automatically generate and distribute personalized PDF certificates to peer reviewers upon completion of their reviews. This plugin was developed to acknowledge and incentivize the invaluable work of peer reviewers in scholarly publishing.

:pushpin: Plugin Information

  • Plugin Name: Reviewer Certificate Plugin
  • Version: 1.0.0
  • Author: Serhiy O. Semerikov (Academy of Cognitive and Natural Sciences)
  • GitHub: GitHub - ssemerikov/reviewerCertificate
  • License: GPL v3.0
  • OJS Compatibility: 3.3.x and 3.4.x

:sparkles: Key Features

:bullseye: Automated Certificate Generation

  • Certificates automatically become available when reviewers complete their assignments
  • No manual intervention required from journal managers
  • Reviewers can download certificates directly from their dashboard

:artist_palette: Fully Customizable Templates

  • Upload custom background images (A4 size)
  • Configure header, body, and footer text with dynamic variables
  • Choose fonts, colors, and text sizes
  • Live preview to test your design before saving

:locked: Security & Verification

  • Each certificate has a unique verification code
  • Optional QR codes for instant verification
  • Public verification endpoint for authenticity checks
  • Access control ensures reviewers only access their own certificates

:bar_chart: Additional Features

  • Batch Generation: Create certificates for historical reviews
  • Multi-language Support: Full internationalization framework
  • Download Tracking: Monitor certificate usage
  • Eligibility Criteria: Set minimum review requirements
  • TCPDF Bundled: No external dependencies needed!

:rocket: Quick Installation

# 1. Navigate to your OJS plugins directory
cd /path/to/ojs/plugins/generic/

# 2. Clone the repository
git clone https://github.com/ssemerikov/reviewerCertificate.git reviewerCertificate

# 3. Set permissions
chmod -R 755 reviewerCertificate/

# 4. Enable in OJS admin panel
# Settings → Website → Plugins → Find "Reviewer Certificate Plugin" → Enable

:camera_with_flash: Screenshots

Certificate Example

Certificates can be fully customized with your journal’s branding, including:

  • Custom backgrounds and logos
  • Personalized text with reviewer name, journal name, and submission details
  • Professional formatting with chosen fonts and colors
  • QR codes for easy verification


Settings Interface

The plugin provides an intuitive settings panel where you can:

  • Design certificate templates using template variables like {{$reviewerName}}, {{$journalName}}, {{$submissionTitle}}
  • Upload background images
  • Configure eligibility criteria
  • Preview certificates before going live



:wrench: How It Works

For Reviewers

  1. Complete a peer review assignment
  2. After submission, a blue notification box appears: “Your Certificate is Ready!”
  3. Click “Download Certificate” to get the PDF
  4. Save for professional portfolio or CV

For Journal Managers

  1. Install and enable the plugin
  2. Configure certificate template in plugin settings
  3. Certificates generate automatically for new reviews
  4. Use batch generation for existing completed reviews

:robot: Development with AI

This plugin was developed with the assistance of Claude Code (Sonnet 4.5) by Anthropic. The AI-powered coding assistant helped throughout the development process with:

  • Code Architecture: Designing the plugin structure and component organization
  • OJS Integration: Ensuring compatibility with OJS 3.3.x and 3.4.x APIs
  • Testing & Debugging: Identifying and fixing compatibility issues
  • Documentation: Creating comprehensive user and technical documentation
  • Code Quality: Analyzing and optimizing code for production use

This modern development approach enabled rapid delivery of production-ready code with comprehensive testing and documentation.

:clipboard: Technical Requirements

  • OJS: 3.3.x or 3.4.x (tested on 3.4)
  • PHP: 7.3+ (PHP 8.0+ compatible)
  • PHP Extensions: GD/Imagick, mbstring, zip
  • TCPDF: :white_check_mark: Bundled (v6.10.0) - no separate installation needed!

:bullseye: Perfect For

  • Journals wanting to recognize reviewer contributions
  • Building reviewer loyalty and engagement
  • Providing verifiable credentials for reviewer portfolios
  • Encouraging quality peer review work
  • Meeting funder requirements for reviewer recognition

:books: Documentation

Comprehensive documentation is available in the GitHub repository:

  • README.md: Complete plugin documentation
  • INSTALL.md: Detailed installation guide
  • REVIEWER_WORKFLOW.md: User workflows and access instructions
  • OJS_3.4_COMPATIBILITY.md: Technical compatibility details
  • CODE_ANALYSIS_REPORT.md: Architecture and development analysis

:handshake: Support & Contributing

  • Issues/Bugs: Please report on GitHub Issues
  • Questions: Feel free to ask here in the forum or contact me directly
  • Contributions: Pull requests are welcome!

:e_mail: Contact

Serhiy O. Semerikov
Academy of Cognitive and Natural Sciences
Email: semerikov@gmail.com


Why This Plugin?

Peer reviewers are the backbone of scholarly publishing, yet their contributions often go unrecognized. This plugin provides a simple, automated way to acknowledge their work with professional certificates they can add to their CVs, tenure files, or professional portfolios.

The certificates are fully customizable to match your journal’s branding and can include verification features to ensure authenticity. With support for batch generation, you can even recognize reviewers retroactively for their past contributions.

Feedback Welcome!

I’d love to hear your thoughts, suggestions, and experiences with the plugin. Please feel free to share feedback here or on GitHub. If you find it useful, consider giving it a :star: on GitHub!

Thank you to the PKP community for creating such an excellent platform that makes plugins like this possible! :folded_hands:


Developed for the Open Journal Systems community to support and recognize the invaluable contributions of peer reviewers to scholarly publishing.

getting error “Failed Ajax request or invalid JSON returned.“ during click on setting after installation.

Same problem here.
Looks like the plugin don’t register it’s tables.

Thanks for the contribution. Looks promising.
Cheers,
m.

Looks really promising and useful… but definitely needs a version compatible with OJS 3.5, which is also being updated soon.

Thanks for supporting the community!

Version 1.0.1 - Critical Bug Fixes and OJS 3.5 Support

Release Date: November 16, 2025

This patch release addresses critical bugs reported by the PKP community and adds official OJS 3.5 compatibility. Upgrading from 1.0.0 is highly recommended for improved stability and reliability.


:wrench: Critical Bug Fixes

Fixed: AJAX Settings Form Error

  • Issue: “Failed Ajax request or invalid JSON returned” when clicking Settings button
  • Impact: Users could not configure plugin settings after installation
  • Solution: Added comprehensive NULL checks, context validation, and exception handling
  • Files Fixed: ReviewerCertificatePlugin.inc.php, CertificateSettingsForm.inc.php, locale/en_US/locale.xml

Fixed: Database Migration Failures in OJS 3.3

  • Issue: Tables not being created during plugin installation
  • Errors: Table 'reviewer_certificates' doesn't exist, Call to a member function connection() on null
  • Impact: Plugin installation completely failed in OJS 3.3
  • Solution: Implemented intelligent dual-strategy migration with automatic fallback from Laravel Schema facade to raw SQL
  • File Fixed: classes/migration/ReviewerCertificateInstallMigration.inc.php

:sparkles: New Features

Manual SQL Installation Scripts

  • Added install.sql - Complete database setup script for manual installation
  • Added uninstall.sql - Clean removal script
  • Provides ultimate fallback for problematic installations
  • Works on all OJS versions (3.3, 3.4, 3.5)

Comprehensive Installation Documentation

  • New INSTALL.md with step-by-step installation instructions
  • Troubleshooting guide for common errors
  • Version-specific installation notes
  • Multiple installation methods documented (automatic, manual SQL, phpMyAdmin)

Official OJS 3.5 Support

  • Added compatibility declaration in version.xml
  • Plugin now installable via OJS 3.5 plugin gallery
  • Fully tested and verified on OJS 3.5
  • Documentation updated for all three supported versions

:bullseye: Improvements

  • Enhanced Error Handling: Exception handling and null checks throughout the codebase
  • User-Friendly Messages: Localized error messages with helpful guidance
  • Improved Logging: Detailed error logging for easier troubleshooting
  • Graceful Degradation: Better handling when optional components are unavailable
  • Complete Documentation: New CHANGELOG.md with full version history

:busts_in_silhouette: Community Feedback Addressed

This release directly resolves issues reported on PKP Community Forum:

  • Dr. Uğur Koçak: Database table creation failures → :white_check_mark: Fixed with automatic SQL fallback
  • Jricst: AJAX settings form error → :white_check_mark: Fixed with null checks and validation
  • Marc: “Plugin don’t register it’s tables” → :white_check_mark: Fixed with improved migration
  • Pedro Felipe Rocha: “Needs OJS 3.5 compatibility” → :white_check_mark: Added official support declaration

:bar_chart: Technical Details

Version: 1.0.1.0
Previous Version: 1.0.0.0
Release Type: Patch (bug fixes and improvements, no breaking changes)

Supported Versions:

  • OJS 3.3.x :white_check_mark: (automatic SQL fallback)
  • OJS 3.4.x :white_check_mark: (modern Laravel migration)
  • OJS 3.5.x :white_check_mark: (latest features, PHP 8+ optimized)

PHP Compatibility:

  • Minimum: PHP 7.3
  • Recommended: PHP 8.0+ (especially for OJS 3.5)
  • Tested: PHP 7.3, 7.4, 8.0, 8.1, 8.2

Testing: All 120 tests passing across all OJS versions


:inbox_tray: Installation

For New Installations

cd /path/to/ojs/plugins/generic/
git clone https://github.com/ssemerikov/reviewerCertificate.git
cd reviewerCertificate
git checkout v1.0.1
chmod -R 755 .

Then enable in OJS admin: Settings → Website → Plugins → Reviewer Certificate Plugin

If automatic installation fails, see INSTALL.md for manual SQL installation instructions.

Upgrading from 1.0.0

Safe to upgrade - no database schema changes, no configuration changes required.

cd /path/to/ojs/plugins/generic/reviewerCertificate/
git pull
git checkout v1.0.1

Then clear OJS cache:

php tools/upgrade.php check

:books: Documentation


:link: Links


:clap: Credits

Author: Serhiy O. Semerikov (Academy of Cognitive and Natural Sciences)
Contact: semerikov@gmail.com
License: GNU General Public License v3.0

Development: Built with Claude Code (Sonnet 4.5) by Anthropic


Thank you to the PKP community for reporting issues and helping improve this plugin! :graduation_cap:

Still unable to run it over OJS 3.3.

Issue reported here:
https://github.com/ssemerikov/reviewerCertificate/issues/56

Cheers,
m.

Installed your plugin (version 1.0.3, OJS 3.5.1), great tool. Still gotta test some features, but I have some suggestions for now.

  1. You should probably provide a “reviewerCertificate.tar.gz” file ready to be installed through Settings > Website > Plugins > "Upload a new plugin" button. I tested this. Created the tar.gz and executed the installation without problems (OJS 3.5.1).

  2. Your installation process guide is too “technical” for the majority of users. Most of the editors aren’t really able to run commands and code stuff like that. Considering you provide a “tar.gz”, a simpler guide would be way more user friendly. Example: the one from GitHub - MejorAbierta/ARTSPlugin: Dynamic Api For PKP products

  3. The locale files you have are “.xml”, but I think OJS 3.5 only recognizes “.po” files. So, for now, the language is broken, showing only english + the ### symbols that indicate the absence of the correct locale files. I localized the text, checked the translation and created the locale.po for the “pt_BR” (Brazilian Portuguese, the native language I speak) folder: [Download] . Hope this file helps.

    Screenshot of the localization:

    Once again, thanks a lot for this tool. It’s a great addition, it will help a lot the whole community!

    I’ll keep testing during the next days.

Many thanks for your update! Kindly ask you to test the fix at Release v1.0.5 - Fix date format and add .po locale files · ssemerikov/reviewerCertificate · GitHub

I attempted to fix OJS 3.3 compatibility, but it still needs testing - see hotfix at Release v1.0.5 - Fix date format and add .po locale files · ssemerikov/reviewerCertificate · GitHub

v1.7.0 - My Certificates

Features

My Certificates Page

A new page at /certificate/myCertificates lets reviewers browse all their issued certificates in one place, with submission titles, dates, and download links. Accessible from the reviewer dashboard.

Unicode Font Auto-Switch

PDF certificates now automatically switch to DejaVu Sans when content contains non-Latin characters (Cyrillic, CJK, Arabic, etc.), regardless of the configured font. No more garbled “???” text!

Locale-Aware Data Retrieval

Certificate generation now respects the active OJS locale — Ukrainian locale returns Ukrainian reviewer names, journal names, and submission titles when available.

Acknowledgments

Special thanks to Dr. Olha Pinchuk (ITLT Journal, Ukraine) for extensive production testing on OJS 3.4.0.8, bug reports, and inspiring the My Certificates page feature.


Download: Use -3_3.tar.gz for OJS 3.3.x, -3_4.tar.gz for OJS 3.4.x, -3_5.tar.gz for OJS 3.5.x

Test Coverage: 158 PHP unit tests + 87 E2E tests = 245 total tests

Assets:

When I upload a proper image for the background of PDF, plugin fails to create pdf preview file. Without any background image it just creates a plain pdf with default content. Here is the error log:

2026/04/04 07:40:18 [error] 1194413#1194413: *122557 FastCGI sent in stderr: “PHP message: ReviewerCertificate: Background image path outside allowed directory” while reading response header from upstream, client: 176.xxx.xxx, server: felsefelik.org, request: “GET /index.php/dergi/$$$call$$$/grid/settings/plugins/settings-plugin-grid/manage?category=generic&plugin=reviewercertificateplugin&verb=preview HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php/php8.3-fpm.sock:”, host: “felsefelik.org”, referrer: “https://felsefelik.org/index.php/dergi/en/management/settings/website”

Thank you in advance.

Hi Serhiy,

We just wanted to say thank you for this plugin. The idea itself is wonderful — acknowledging reviewers properly is something journals rarely have time to do well, and your plugin turns what used to be hours of manual work into something automatic. For our journal it’s a real gift: the bilingual template, the QR verification page, the “My Certificates” page — all of it is exactly what we needed.

We’re running it on the shared Croatian OJS installation (ojs.srce.hr) and ran into a background-image preview issue, which our hosting colleague and we have described here, in case it’s useful:

No rush at all — we just wanted to flag it and, above all, to thank you for building and sharing this. We’d be very happy to help test whenever a fix is ready.

With appreciation,
The Editorial Team
Diacovensia – Teološki prilozi, Catholic Faculty of Theology in Đakovo, Croatia

Hi @ismailserin, thanks for the detailed report that log line pinpoints it exactly.

What’s happening: before embedding your background image, the plugin verifies the image sits inside your OJS files directory. In plugin versions before 1.8.0, both the upload and that safety check assumed the files directory was {OJS}/files/, i.e. inside the OJS installation folder. Your server keeps files_dir outside the OJS folder which is the correct, recommended configuration so the check looked in the wrong place, judged the freshly-uploaded image as “outside the allowed directory”, and dropped it. That’s why the preview comes out with no background (and with no image you get the plain default PDF).

This is issue #69/#71, and it’s fixed in v1.8.0 current release v1.8.1. The plugin now reads the real files_dir from your config.inc.php, so the upload and the preview agree no matter where your files directory lives. You don’t need to change anything in config.inc.php.

How to fix:

  1. Download the package for your OJS version from the releases page:
    OJS 3.4: reviewerCertificate-1.8.1-3_4.tar.gz
    OJS 3.5: reviewerCertificate-1.8.1-3_5.tar.gz
    OJS 3.3: reviewerCertificate-1.8.1-3_3.tar.gz
    Releases · ssemerikov/reviewerCertificate · GitHub
  2. In OJS: Settings - Website - Plugins - Upload A New Plugin this upgrades in place and keeps your existing settings.
  3. Open the plugin settings, re-upload the background image, and click Preview again it should now render with the backg

Best,
Serhiy

Dear Editorial Team,

Thank you - this message genuinely made our day. Tools like this are worth building precisely because of journals like Diacovensia who put them to real use, and knowing the bilingual template, the QR verification page and the “My Certificates” page are landing exactly where you needed them means a great deal.

Good news on the background-image preview you flagged: it’s already fixed. Your hosting colleague Nino diagnosed it precisely in issue #71 and you confirmed bug 3 from the journal side where both the upload path and the PDF generator’s validation were hardcoded to {OJS}/files/. On a shared installation like ojs.srce.hr the files directory lives outside the OJS folder, so the uploaded image was saved but then judged “outside the allowed directory” and skipped, leaving the preview blank. As of v1.8.0 (now v1.8.1) the plugin reads the real files_dir from config.inc.php, so the image validates and renders wherever Srce keeps your files.

The happy coincidence: the v1.8.1 package you’re already asking Srce to deploy for the Croatranslation (issue #72) is the preview bug. So a singledeployment of reviewerCertificate-1.8.1-3_4.tar.gz (for your OJS 3.4.0-9) gives you, in onestep, the background-image fix,localization, and thepage-orientation corrections.

With sincere thanks to you, the whole editorial team,
Serhiy

Bug: Infinite recursion / fatal stack overflow on first certificate download (getInsertId loop)

Plugin: Reviewer Certificate OJS version: 3.4.0.10

Every reviewer’s first certificate download (i.e. when no row yet exists for them in reviewer_certificates) crashes with a PHP Fatal error caused by infinite recursion between CertificateDAO::getInsertId() and the core PKP\db\DAO::_getInsertId(). Downloads for reviewers who already have a certificate row work fine, since that path skips the insert and only updates download_count / last_downloaded. The bug only fires on the create/insert path.

Steps to reproduce

  1. Find a review assignment that is completed and acknowledged by the editor (date_completed and date_acknowledged both set), where the reviewer has no existing row in reviewer_certificates.
  2. Log in as that reviewer (or impersonate via admin).
  3. Click “Download Certificate” for that review.

Result: Browser returns HTTP 500. PHP error log fills with tens of thousands of repeated recursive stack frames until PHP’s stack size limit is hit.

Expected: Certificate generates and downloads normally, as it does for reviewers who already have an existing certificate record.

Exact error log output (copied verbatim)

[17-Aug-2026 05:31:27 Asia/Riyadh] PHP Fatal error:  Uncaught Error: Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? in /home/[REDACTED]/journal.seisense.com/plugins/generic/reviewerCertificate/classes/CertificateDAO.php:358
Stack trace:
#0 /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/db/DAO.php(213): APP\plugins\generic\reviewerCertificate\classes\CertificateDAO->getInsertId()
#1 /home/[REDACTED]/journal.seisense.com/plugins/generic/reviewerCertificate/classes/CertificateDAO.php(359): PKP\db\DAO->_getInsertId()
#2 /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/db/DAO.php(213): APP\plugins\generic\reviewerCertificate\classes\CertificateDAO->getInsertId()
#3 /home/[REDACTED]/journal.seisense.com/plugins/generic/reviewerCertificate/classes/CertificateDAO.php(359): PKP\db\DAO->_getInsertId()
#4 /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/db/DAO.php(213): APP\plugins\generic\reviewerCertificate\classes\CertificateDAO->getInsertId()
#5 /home/[REDACTED]/journal.seisense.com/plugins/generic/reviewerCertificate/classes/CertificateDAO.php(359): PKP\db\DAO->_getInsertId()
#6 /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/db/DAO.php(213): APP\plugins\generic\reviewerCertificate\classes\CertificateDAO->getInsertId()

(pattern repeats identically for roughly 47,000+ frames, then terminates with:)

#47280 /home/[REDACTED]/journal.seisense.com/plugins/generic/reviewerCertificate/classes/CertificateDAO.php(359): PKP\db\DAO->_getInsertId()
#47281 /home/[REDACTED]/journal.seisense.com/plugins/generic/reviewerCertificate/classes/CertificateDAO.php(176): APP\plugins\generic\reviewerCertificate\classes\CertificateDAO->getInsertId()
#47282 /home/[REDACTED]/journal.seisense.com/plugins/generic/reviewerCertificate/controllers/CertificateHandler.php(273): APP\plugins\generic\reviewerCertificate\classes\CertificateDAO->insertObject()
#47283 /home/[REDACTED]/journal.seisense.com/plugins/generic/reviewerCertificate/controllers/CertificateHandler.php(170): APP\plugins\generic\reviewerCertificate\controllers\CertificateHandler->getOrCreateCertificate()
#47284 [internal function]: APP\plugins\generic\reviewerCertificate\controllers\CertificateHandler->download()
#47285 /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/core/PKPRouter.php(334): call_user_func()
#47286 /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/core/PKPPageRouter.php(278): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest()
#47287 /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\PKPPageRouter->route()
#47288 /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/core/PKPApplication.php(395): PKP\core\Dispatcher->dispatch()
#47289 /home/[REDACTED]/journal.seisense.com/index.php(21): PKP\core\PKPApplication->execute()
#47290 {main}
  thrown in /home/[REDACTED]/journal.seisense.com/lib/pkp/classes/db/DAO.php on line 213

Likely root cause

The call chain shows CertificateDAO::insertObject() (line 176) calling CertificateDAO::getInsertId() (line 359), which calls PKP\db\DAO::_getInsertId() (core, line 213), which then calls back into CertificateDAO::getInsertId() again, and this repeats until the stack overflows.

In current PKP core, _getInsertId() is a legacy/back-compat shim that simply forwards to getInsertId(), it no longer performs the raw last-insert-id lookup the way the old ADOdb-era API did. If CertificateDAO::getInsertId() is implemented to call $this->_getInsertId(...) internally (the older pre-refactor pattern used by many pre-3.4 plugin DAOs), it creates exactly this ping-pong: getInsertId() calls _getInsertId(), which calls getInsertId() again, forever.

The fix should be for CertificateDAO::getInsertId() to retrieve the last insert ID directly (e.g. via the Laravel/Illuminate DB layer PKP now uses, such as DB::getPdo()->lastInsertId()), rather than delegating to _getInsertId().

Impact

This affects every reviewer’s first certificate download, i.e. any reviewer with an acknowledged completed review but no existing row in reviewer_certificates. It is not an edge case. Reproduced reliably: reviewers with a pre-existing certificate row download fine (hits the update path only), reviewers without one crash every time (hits the broken insert path).

Additional finding: the row is actually written to the database successfully before the crash. Confirmed by checking reviewer_certificates immediately after a reproduced crash: a row exists with date_issued matching the crash timestamp. The recursion appears to happen after the INSERT commits, while retrieving the insert ID for use afterward (setting the object’s ID, generating the certificate file, etc). This means:

  • The first download attempt always fails with an HTTP 500 and floods the error log, but does not lose data.
  • A second attempt by the same reviewer for the same review succeeds immediately, since getOrCreateCertificate() now finds the existing row and skips the broken insert path entirely.

So the practical impact is: every reviewer’s very first certificate download for a given review fails with a confusing error page and generates a very large log entry (47,000+ stack frames per occurrence), but retrying resolves it. Still worth fixing given the poor first-time experience and the server load each occurrence causes.

Happy to provide further logs, DB schema, or test on request. Please advise if a patched build is available.

Fix

in this file plugins/generic/reviewerCertificate/classes/CertificateDAO.php

Replacing the getInsertId() method (around line 355) with:

php

public function getInsertId(): int {
    // Do NOT use _getInsertId(): on some PKP core versions it still exists
    // but only as a compatibility shim that calls back into getInsertId(),
    // causing infinite recursion. Go straight to the DB layer instead.
    if (class_exists('Illuminate\Support\Facades\DB')) {
        try {
            $pdo = \Illuminate\Support\Facades\DB::getPdo();
            if ($pdo !== null) {
                return (int) $pdo->lastInsertId();
            }
        } catch (\Throwable $e) {
            error_log('ReviewerCertificate: getInsertId() Laravel fallback failed: ' . $e->getMessage());
        }
    }
    return 0;
}

Tested on our install: first-time certificate download now works cleanly, no crash, no recursion, no log spam.

Thank you for such a well-researched report — the stack trace, the observation that the row was already committed, and the note that only the first download fails made this quick to confirm. Your diagnosis was exactly right, and v1.9.0 is now out with the fix.

What was happening

pkp-lib 3.4 declares two methods in classes/db/DAO.php:

protected function getInsertId(): int
{
    return DB::getPdo()->lastInsertId();
}

/** @deprecated 3.4 */
public function _getInsertId(): int
{
    return $this->getInsertId();
}

The plugin overrode getInsertId() and called _getInsertId() from inside it. Since _getInsertId() does nothing but call $this->getInsertId(), PHP dispatched straight back into the plugin’s override — hence the ping-pong you saw. It only fired on the insert path, so a reviewer with an existing row never hit it.

The ('reviewer_certificates', 'certificate_id') arguments were a leftover from the ADOdb era. PHP silently accepts extra arguments to userland functions, so nothing failed early to reveal the mistake.

Two small corrections to your patch

Your fix works on 3.4 and 3.5, but it would break OJS 3.3. There, Illuminate\Support\Facades\DB exists but the connection is not bootstrapped, so getPdo() throws, the catch swallows it, and the method returns 0 — every certificate would be saved with certificate_id = 0.

Also worth noting: OJS 3.3’s _getInsertId() takes no arguments either. It has used Capsule::getPdo()->lastInsertId() since 3.3, so those two arguments have been dead for a long time.

What shipped

The plugin no longer overrides a core method at all — the logic moved to getLastInsertId(), a name core never dispatches to, which makes the recursion structurally impossible rather than merely avoided:

  1. OJS 3.4 / 3.5 — DB::getPdo()->lastInsertId(), the same mechanism core uses
  2. OJS 3.3 — falls through to core’s own working _getInsertId()
  3. If neither reports an ID, the row is re-read by its unique certificate_code (this also hardens PostgreSQL, where lastInsertId() without a sequence name is unreliable)

A re-entrancy guard is in place in case core changes shape again.

Two things your report did not mention, but were caused by the same bug

  • Batch certificate generation failed for every reviewer, silently — the manager just saw generated: 0.
  • The email-certificate action went through the same create path and failed identically.

Also, the symptom depends on your PHP version. You are on 8.3+, which reports Maximum call stack size ... reached. Infinite recursion?. On older PHP there is no stack guard, so the process exhausts the memory limit first and logs Allowed memory size ... exhausted instead — same bug, different message, which may help anyone searching the forum.

Why it was not caught earlier

The test suite mocked the base DAO with a harmless _getInsertId() for every OJS version, so the recursion was unreachable by construction. The mocks now mirror the real pkp-lib class shape per version — 3.3’s real implementation, 3.4’s recursive deprecation shim, and 3.5 with the method removed — and there is an end-to-end test that empties the certificate table first to force the create path, because an existing row hides the bug completely.

Downloads

Verified end-to-end on all three OJS Docker images — 3.4 being 3.4.0-10, the exact version you reported. With the fix reverted the container reproduces your HTTP 500; with it applied, a valid PDF and a real certificate_id.

The same release also closes your GitHub issue #74 (header text is now optional, and there is a new “Body Top Spacing (mm)” setting for moving the body down the page) and #73 (the background image can now be removed without uploading a replacement).

Thanks again — this was a genuinely useful bug report.