OJS 3.0.2 Register User Form Problem

Hello,

I’m getting a fatal error trying to access the new user registration screen on a fresh install of OJS 3.0.2-stable from GitHub.

I first get a notice regarding undefined variable
PHP Notice: Undefined variable: context in /xxx/xxx/test_html/lib/pkp/classes/user/form/RegistrationForm.inc.php on line 117

Then the fatal error
PHP Fatal error: Call to a member function getSetting() on null in /xxx/xxx/test_html/lib/pkp/classes/user/form/RegistrationForm.inc.php on line 117

It’s looking for this
if ($request->getContext() && !$context->getSetting(‘disableUserReg’))

User registration is set to yes in Site Access Options.

I should say that it is actually a 2.4.x update to OJS 3.0.2-stable

Hi @verdonv,

Can you double-check that both your application and lib/pkp submodules are up to date? I suspect one of them (probably lib/pkp) is out of date.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I’m suspecting now, that I’m on the main trunk in lib/pkp and not where I should be for OJS 3.0.2-stable (keep in mind I’m relatively new to git). Should the branch for lib/pkp be the same number as for OJS?

Following is my output

$ git status
# On branch ojs-stable-3_0_2
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#	deleted:    cache/t_cache/.gitignore
#	deleted:    cache/t_compile/.gitignore
#	modified:   lib/pkp (modified content)
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	plugins/importexport/quickSubmit/
#	plugins/themes/cjarDefault/
#	plugins/themes/defaultManuscript/
no changes added to commit (use "git add" and/or "git commit -a")

$ cd lib/pkp/

$ git status
# Not currently on any branch.
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   composer.lock
#
no changes added to commit (use "git add" and/or "git commit -a")

Hi @verdonv,

You should be on the same branch for both. On the stable branch it should be safe to…

git fetch
git checkout ojs-stable-3_0_2
cd lib/pkp
git fetch
git checkout ojs-stable-3_0_2

That should get you up to date, and git status should show the same branch for both repos.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks @asmecher

Interestingly enough, if I

git checkout tags/ojs-3_0_2-0

I’m good and it seems to work, or at least the form loads with no error.

If I

git checkout ojs-stable-3_0_2 

I get the same errors I was getting initially.

if I git status now with both branches checked out

$ git status
# On branch ojs-stable-3_0_2
# Your branch is behind 'origin/ojs-stable-3_0_2' by 4 commits, and can be fast-forwarded.
#
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#	deleted:    cache/t_cache/.gitignore
#	deleted:    cache/t_compile/.gitignore
#	modified:   lib/pkp (modified content)
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	plugins/importexport/quickSubmit/
#	plugins/themes/cjarDefault/
#	plugins/themes/defaultManuscript/
no changes added to commit (use "git add" and/or "git commit -a")

cd lib/pkp/

$ git status
# On branch ojs-stable-3_0_2
# Your branch is behind 'origin/ojs-stable-3_0_2' by 2 commits, and can be fast-forwarded.
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#	modified:   composer.lock
#
no changes added to commit (use "git add" and/or "git commit -a")

I ‘think’ when it is telling me that my branch is behind by x commits and can be fast-forwarded, it is just due to me adding plugins/themes and running composer?

Hi @verdonv,

When it says that the lib/pkp submodule is “behind ‘origin/ojs-stable-3_0_2’ by 2 commits”, that means there are 2 commits in the official repository that aren’t present in yours. Try a git pull or, failing that, git reset --hard origin/ojs-stable-3_0_2 – be warned that the latter will discard any local changes. I suspect one of those two commits is the problem.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks very much @asmecher. I’m not sure how I got in that state, but the git pull (on the pkp lib) got me where I needed to be.

1 Like