When switching to MSSQL (same server, same PHP config, same codebase) I get errors with quotes being incorrectly escaped with backslashes. (Even with sybase quotes enabled, i.e. a double quote not a backslash). Any combination of php magic quotes config yields the same result.
Has anyone been able to get Hotpot working correctly under MSSQL?
At this stage it does seem that something about Hotpot+MSSQL is causing the problem.
Thanks in advance
As you will notice only some of the quotes have been escaped which is very odd and suggests a problem with Hotpot+MSSQL rather than server/magic quotes config.
this is difficult for me to test because I do not have a MSSQL set up.
I would be interested to know how other types of Hot Potatoes quiz behave and how other modules (quiz, assignment, etc) behave when dealing with quotes on the MSSQL server.
Other modules are fine, as is the core of the site.
I shall test some more types of Hotpot quizzes and get back to you.
It is very odd that only some quotes in the file have been escaped (see jobrolescrossword_corrupt.htm)
I am trying to set up a server to replicate your situation. Could you tell me what version of MSSQL you arr using.
We are using SQL Server 2005 Enterprise SP2 (9.0.3042)
I believe the (free) Express edition will behave the same as the Enterprise edition in this context if you are unable to use Enterprise edition for whatever reason (presumably license issues)
- Additional crossword exercises
- Mixed-up sentence
Thanks for the extra information Alistair.
> Let me know if you need me to post the corrupted versions of the above
Actually, what I would like more than the corrupted files, is help setting up MSSQL Server Express, because I am struggling a bit with that.
One thing I found out during the set up, was that the Moodle docs advise you use certain settings in order to ensure correct escaping of quotes:
Probably you have seen that page already, but I would just like to check that you have followed the suggestions there for quote settings and using FreeTDS?
I was immediately able to confirm the problem you reported, namely that on an MSSQL server, all HotPots are impaired to a greater or lesser extent by the odd escaping of double quotes.
I will try to find a fix for it over the weekend and let you know how I got on.
Thanks for your help
after further investigation, I found that this problem arose from the fact that installing MSSQL on a Windows server changes the behavior of the PHP function "stripslashes".
After installing MSSQL on my server, I confirmed that Moodle 1.8 had the problem, but I got a shock when the HotPots on Moodle 1.7 were also messed up! Something fundamental was amiss
I rolled up my sleeves (it's autumn now in Japan) and set about locating where the slashes were being added. They are introduced by functions in the HotPot module which search for relative URLs in the quiz file and replace them with absolute URLs. These functions use PHP's "preg_replace" function, which adds slashes - I knew about that. The HotPot functions use PHP's "stripslashes" function to attempt to remove the slashes added by "preg_replace", but the slashes were NOT being removed.
I tried the same quiz on a separate server which does NOT have MSSQL installed and the slashes were removed as expected.
In this way, I was able to isolate the problem to the different behavior of the "stripslashes" function on the two servers. To solve the problem, I wrote a new "hotpot_stripslashes" function, which always correctly removes the slashes added by "preg_replace", thereby side stepping the variable behavior of "stripslashes".
The affected script was "mod/hotpot/lib.php" and I have updated the CVS for Moodle 1.7, 1.8 and HEAD (the "developement" branch of Moodle). The modified script should be available via CVS or from the Moodle downloads page shortly.
At the moment, I don't seem able to update the CVS for Moodle 1.9, but that is a separate problem.
Thanks for reporting this problem. Please confirm the fix when you are able
($Id: lib.php,v 22.214.171.124 2007/10/02 07:39:11 gbateson Exp $)
After a quick test I can confirm that all the resources that I was having problems with now work perfectly
thanks for the confirmation. It's great news that the HotPot module is working well on your MSSQL site
all the best!