## WeBWorK Problems

### /webwork2/instructorXMLHandler: Forbidden

by Siman Wong -
Number of replies: 3

system:    ww version 2.13

problem:  Library/Rochester/setLinearAlgebra11Eigenvalues/ur_la_11_30.pg

How to reproduce this:  I created a new problem set with just this one question.  The problem renders correctly in the Library Viewer or under Homework Sets --> this problem set.  However, if I click Homework Sets Editor --> View Detail 2 of this set --> render this question, I get a pop-up box with this error message.

Additional details:  When I turn on Developers Tools of my browser (firefox & chrome), I see that there are a bunch of error messages like this:

Use of getPreventDefault() is deprecated.  Use defaultPrevented instead.

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help http://xhr.spec.whatwg.org/

Is this a ww bug, or is this an issue with our ww configuration/server setup?

Thanks!

### Re: /webwork2/instructorXMLHandler: Forbidden

by Danny Glin -

I get the same error on my ww 2.14 installation.  I don't see the javascript errors you mention, so those may be unrelated.

This issue occurs for a number of problems.  I know that certain extended characters trigger this (see https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4795), so it's possible that there is some weird character saved in this file.

I have used problems with this error in homework sets with no issue.  It doesn't affect the student view, and I've never had reports of it causing any problems with grading.  It only appears in places where the XML renderer is used (Homework Sets Editor, Library Browser, and maybe one or two other instructor pages), so I consider it safe to use such problems in homework.

### Re: /webwork2/instructorXMLHandler: Forbidden

by Nathan Wallach -

I looked in /var/log/apache/error.log (Ubuntu location) and saw the following (slightly cleaned up after cut+paste) when tested with a Docker version running more-or-less the develop branch of WW. What it indicated is that this problem cannot be handled by the XML code needed to do the "inline" display of this problem, and is not just a matter of UTF-8 characters causing problems.

 Error message for command: renderProblem faultcode: Server faultstring: Not an ARRAY reference at /opt/webwork/webwork2/lib/WebworkWebservice/RenderProblem.pm line 581. End error message [Wed Oct 07 17:21:56.368637 2020] [perl:error] [pid 77] [client 172.19.0.1:33102] [/webwork2/instructorXMLHandler] Error message for command: renderProblem \n faultcode: Server \n >faultstring: Not an ARRAY reference at /opt/webwork/webwork2/lib/WebworkWebservice/RenderProblem.pm line 581.\n \n End error message \n * in WeBWorK::ContentGenerator::instructorXMLHandler::content called at line 233 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm\n * in WeBWorK::ContentGenerator::go called at line 386 of /opt/webwork/webwork2/lib/WeBWorK.pm, referer: http://localhost:8080/webwork2/Madar_devel/instructor/sets2/035-hw03-additional-problems/ 

I hacked at the code a bit, and the XML conversion is failing to handle a Value::Matrix as the value of correct_value inside an AnswerHash object. It seems that we are running into limitations of the current support WW has for rendering problems via XML. That also implies that it probably cannot be handled by the xml2html system for embedding problems in a web page, as it would also need to undergo the encoding to XML which is failing.

It is possible that the XML support code could be extended to handle Value::Matrix with special code, but that is a project to consider in the future. I've created a GitHub issue about this.

Out of  curiosity I tried out this problem in the new Rederly standalone renderer, and it renders fine there.

1. The OPL file should have used Context()->normalStrings; after END_TEXT. If that is added, the problem seems to render inline (for me, using the icon to render the problem). This is a matter of the XML code being more sensitive to some things than the regular problem rendering code.
2. The XML generation code in xml_filter which is used to process the inline rendering incorrectly detects something in the answer hash as an array reference, and then runs into a fatal error. I think I have a patch for this which I put in https://github.com/openwebwork/webwork2/pull/1146. Hopefully that patch will make it into a future version of WW, so that this sort of issue will not occur elsewhere.