## WeBWorK Main Forum

### Homework sets permission-like error

by Kurt O'Hearn -
Number of replies: 2
Hello all,

I stumbled across an interesting WeBWorK scenario a few days ago that lead to an interesting error (that I'm not sure if I fully understand). First, here's the error:

### Error messages

Can't use an undefined value as a HASH reference at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 1274.

### Call stack

The information below can help locate the source of the problem.

• in WeBWorK::ContentGenerator::Problem::output_summary called at line 152 of /opt/webwork/webwork2/lib/WeBWorK/Template.pm
• in WeBWorK::Template::template called at line 494 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
• in WeBWorK::ContentGenerator::content called at line 198 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
• in WeBWorK::ContentGenerator::go called at line 371 of /opt/webwork/webwork2/lib/WeBWorK.pm

Next, the context that generated it: here at Grand Valley State, we have a group of instructors developing a standard WeBWorK curriculum for a few of our math courses. To facilitate this process, I set up a course to be shared amongst these instructors. Each instructor in the course had two user accounts, with professor and student privileges, respectively. Instructors were creating there own homework sets to work on different areas of the curriculum.

What occurred to produce the error: one instructor created a homework set which was not assigned to all the users in the course. Then another instructor came along and attempted to copy/edit problems in the homework set.

What resolved the error: if the set was assigned to all users in the course, the second instructor could manipulate the set without errors as desired (e.g., editing a problem in the set to their pedagogical liking).

My suspicion is this error stems from some permission-like value stored in the WeBWorK DB which is set upon homework set creation/assignment. I'm curious if this situation was intened or if this is an unforeseen consequence of the design (that could cause more future problems). For example, a `team-taught' course would very likely run into this problem.

-Kurt
In reply to Kurt O'Hearn

### Re: Homework sets permission-like error

by Michael Gage -
I suspect it's more likely a matter of some variable not being initialized (because the initialization would normally occur when the problem is assigned to the user).

Originally it was not expected that any editing would take place on problems unless they had been assigned to the instructor editing them. That has been relaxed in various ad hoc ways since the early days but I'm not shocked to find that there are still some holes/bugs in the initialization that need to be worked around.  Do you know what version of the webwork2 code you have?

My version (bleeding edge) has the output_summary occurring around lines 1317 -- so it's possible that some of this has been fixed (accidentally) in recent work.

My code is at github.com/mgage.

When I get a chance I'll try to duplicate the bug in my code base, but it may take a while before I get to it.  You gave a very clear account of how to trigger it.  It would be worth reporting it to bugzilla so that it doesn't get lost. (use Report Bugs link in the menu on the left.)

-- Mike

In reply to Michael Gage

### Re: Homework sets permission-like error

by Kurt O'Hearn -
WeBWorK release: 2.5.0
WeBWorK revision: 7129 (subversion repo)
Bugzilla report: http://bugs.webwork.maa.org/show_bug.cgi?id=2368

-Kurt