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
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

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: 910
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: Google [Bot] and 1 guest