PHP Fatal error: Uncaught Error: Call to a member function getYear() on null in /var/www/ojs/plugins/generic/googleScholar/GoogleScholarPlugin.inc.ph p:102\nStack trace:\n#0 /var/www/ojs/lib/pkp/classes/plugins/HookRegistry.inc.php(107): GoogleScholarPlugin->submissionView('ArticleHandler:...', Array)\n#1 /var/www/ojs/pages/article/ArticleHandler.inc.php(280): HookRegistry::call('Arti cleHandler:...', Array)\n
This causes a HTTP500 for any articles for which $issue is not defined.
The error is:
PHP Fatal error: Uncaught Error: Call to a member function getYear() on null in /var/www/ojs/plugins/generic/googleScholar/GoogleScholarPlugin.inc.ph p:102\nStack trace:\n#0 /var/www/ojs/lib/pkp/classes/plugins/HookRegistry.inc.php(107): GoogleScholarPlugin->submissionView('ArticleHandler:...', Array)\n#1 /var/www/ojs/pages/article/ArticleHandler.inc.php(280): HookRegistry::call('Arti cleHandler:...', Array)\n
This causes a HTTP500 for any articles for which $issue is not defined.
This is the line causing the problem:
if (is_a($submission, 'Submission') && ($datePublished = $submission->getDatePublished()) && (!$issue->getYear() || $issue->getYear() == strftime('%Y', strtotime($datePublished)))) {
Our fix was to move the following line:
if ($issue) {
up from where it appears 7 lines below so that the section 111-122 appears as:
if ($issue) { if (is_a($submission, 'Submission') && ($datePublished = $submission->getDatePublished()) && (!$issue->getYear() || $issue->getYear() == strftime('%Y', strtotime($datePublished)))) { $templateMgr->addHeader('googleScholarDate', '<meta name="citation_date" content="' . strftime('%Y/%m/%d', strtotime($datePublished)) . '"/>'); } elseif ($issue && $issue->getYear()) { $templateMgr->addHeader('googleScholarDate', '<meta name="citation_date" content="' . htmlspecialchars($issue->getYear()) . '"/>'); } elseif ($issue && ($datePublished = $issue->getDatePublished())) { $templateMgr->addHeader('googleScholarDate', '<meta name="citation_date" content="' . strftime('%Y/%m/%d', strtotime($datePublished)) . '"/>'); } if ($issue->getShowVolume()) $templateMgr->addHeader('googleScholarVolume', '<meta name="citation_volume" content="' . htmlspecialchars($issue->getVolume()) . '"/>'); if ($issue->getShowNumber()) $templateMgr->addHeader('googleScholarNumber', '<meta name="citation_issue" content="' . htmlspecialchars($issue->getNumber()) . '"/>'); }
Ideally, wouldn't want this overwritten in a future release and so posting it up here so it can be considered for future versions