You are viewing the PKP Support Forum | PKP Home Wiki

Undefined variable templateMgr

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Undefined variable templateMgr

Postby Banderson » Tue Feb 21, 2012 10:24 am

We recently discovered a server error on the third step of schedConfSetup in one of our OCS instances (running version 2.1.2-1). Cranking up error reporting, I got a message indicating that there was an undefined variable (@templateMgr) on line 62 of classes/manager/form/schedConfSetup/SchedConfSetupStep3Form.inc.php. This is in the display function:

function display() {
$mail = &new MailTemplate('SUBMISSION_ACK');
if ($mail->isEnabled()) {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('submissionAckEnabled', true);

if (Config::getVar('general', 'scheduled_tasks'))
$templateMgr->assign('scheduledTasksEnabled', true);


If I add:

$templateMgr =& TemplateManager::getManager();

... to the second "if" statement here, before the variable is assigned; but since I can't find a patch for this, I suspect there may be something else going on. Is there something we're not enabling in the interface? Is my kludge going to mess up other things?

Any help appreciated,

Bill Anderson
Georgia Tech Library
Posts: 20
Joined: Tue Jan 22, 2008 8:24 am

Re: Undefined variable templateMgr

Postby JasonNugent » Tue Feb 21, 2012 11:04 am

Hi Bill,

That's a bug in the version of OCS you are using. It was fixed about three years ago in this commit:

https://github.com/pkp/ocs/commit/40d47 ... rm.inc.php

The problem is that the line:

Code: Select all
$templateMgr =& TemplateManager::getManager();

needs to be outside of the if() statement it is in. The problem with the way it is now is that it creates a variable in local scope. If you don't intend to upgrade, you can just move the line to just after the function display() { opening block.

Site Admin
Posts: 791
Joined: Tue Jan 10, 2006 6:20 am

Re: Undefined variable templateMgr

Postby Banderson » Tue Feb 21, 2012 11:15 am

Thanks, Jason -- pretty much what I figured. I just wanted to make sure there wasn't some reason for declaring the variable there.


Posts: 20
Joined: Tue Jan 22, 2008 8:24 am

Return to OCS Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests