Cloze Question: Notice: Object of class stdClass could not be converted to int

Cloze Question: Notice: Object of class stdClass could not be converted to int

by Dan Fenske -
Number of replies: 21
I am trying to create my first Cloze type question. Whenever I click on "Decode and Verify Question Text" the following error appears:

Notice: Object of class stdClass could not be converted to int in /srv/moodle/web/question/type/multianswer/edit_multianswer_form.php on line 39

I copied the syntax directly from one of the questions in the Moodle docs, so I could get the hang of it.

The actual question is:

{1:NUMERICAL:=1492:0.0#Feedback}Year of discovery.

The question works, but that Notice: line appears and is kind of annoying.
I am using version 1.9.3 and am at a loss as to explain what is going on.
Average of ratings: -
In reply to Dan Fenske

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
We are currently testing upgrading from moodle 1.8 to 1.9.3 on our university test site and I am getting exactly the same php error notice whenever editing or using Cloze questions.
(with debug mode ON). Any help?
Joseph
In reply to Joseph Rézeau

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Further to my previous post: I am getting the PHP error notice not only when clicking the "Decode and Verify Question Tex" but also when editing a cloze question, when viewing it in Preview mode and when taking the quiz...
Any idea what might cause this PHP error notice to appear?
Joseph

EDIT.- What is worse, this error prevents the feedback from being displayed when the student hovers over his answers.
In reply to Joseph Rézeau

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Actually, this is worse than I thought, we are getting the PHP error notice on any type of question at the moment. And no feedback is displayed on any question.
I do appreciate that this problem has arisen with our upgrading from 1.8 to 1.9 but do not know how to advise our tech people about it.
Joseph
In reply to Joseph Rézeau

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
fixed by our moodle site admin
Joseph
In reply to Joseph Rézeau

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Pierre Pichet -
I will take a look and set a bug if necessary.
Pierre

In reply to Dan Fenske

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Pierre Pichet -
I pinpoint the problem and have created MDL-17995.
Will try to solve before 1.9.4 release i.e in the weekend.

Pierre
In reply to Pierre Pichet

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Dan Fenske -
My apologies. My Moodle version is 1.9.2 not 3. How do I determine which PHP is being used?
In reply to Dan Fenske

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Dan Fenske -
I found my version of PHP. 5.1.6
In reply to Dan Fenske

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Pierre Pichet -
As far as we know, MDL-17995 is closed and fixed so If you could load the last version, everything should bo OK.
Pierre
In reply to Pierre Pichet

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Jeff Forssell -
I am using Moodle 1.9.5+ build 20090909 and got this on some numerical CLOZE questions.
In reply to Jeff Forssell

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Pierre Pichet -
Hi Jeff,

Did you get the same notify message at the same line code 39?

Can you give the text of your numerical CLOZE questions.

Pierre



In reply to Pierre Pichet

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Jeff Forssell -
I'm getting (with NORMAL error reporting):

What number is after 1?

Notice: Object of class stdClass could not be converted to int in /home/tupo/public_html/LMS/question/type/multianswer/questiontype.php on line 276
 

The question works anyhow.

I tried making a very simple question, because the ones i tried first were in a complex table layout, but still got this.


the question is very simple:

What number is after 1? <br />{2:NUMERICAL:=2#RIGHT}

But I can't exclude the possibility of some hacker. I am presently cleaning out some older Moodles on the same site that had been hacked.
In reply to Jeff Forssell

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Pierre Pichet -
I cannot reproduce the Notice.
Could you check your HTML question text if there are no Windows Word unclean data.
Although similar Notice, this is somehow different from MDL-17995.


I presume that the Notice appears when previewing the question and not when editing.

Pierre



In reply to Pierre Pichet

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Jeff Forssell -
The notice appeared when previewing. No problem with WORD or other extra scrap, I sent the [<>] code.

But when I check again I don't get it! I tried turning NORMAL error code showing again (and even Server performance, because I had turned that off in between). But I don't get the error message again.

So we can drop this until it shows up again. Thanks for checking.
In reply to Jeff Forssell

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Teresa Silves -

I am getting the above notice with every Cloze question I create. 

I have tried using Hot Potatoes and copying and pasting the sample text from the moodle docs.

Below is a sample question:

  Write the fraction when:

14 is the numerator and 45 is the denominator.
Notice: Object of class stdClass could not be converted to int in /var/www/html/moodle/question/type/multianswer/questiontype.php on line 276

In reply to Teresa Silves

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Teresa,
could you tell us what version of Moodle you are using?

Also, please attach your Hot Potatoes quiz file to your next post to this forum, so that I can test that it imports OK onto my Moodle testing server.

thanks
Gordon

In reply to Gordon Bateson

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Teresa Silves -

We are running Moodle 1.9.7. PHP version 5.1.6 and mySQL 5.0.77

I was also wondering if it would be possible to have a two part cloze question where both parts must be correct in order to receive full credit for the question.

ie Comple the sequence.

30, 36, 42,  ____, ____

Where the student must fill in a blank for 48 and 54 in order to receive full credit for their answer.

Thanks Gordon

In reply to Teresa Silves

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Teresa,

I just tried importing the file into Moodle 1.9.9, PHP 5.3.3, MySQL 5.0.7 and there was no problem, so maybe the first thing to do is to upgarde your Moodle site to the latest stable version and see if that improves the situation.

regards
Gordon

In reply to Teresa Silves

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Jeff Forssell -

If you make two cloze expressions for the 48 and 54 they will have to get both right to get full credit.  But maybe you want them to get nothing for only one right?

In the latter case you could have one CLOZE but would probably have to have  "48 54" "48,54" and "48, 54" (at least) as right.

In reply to Jeff Forssell

Re: Cloze Question: Notice: Object of class stdClass could not be converted to int

by Pierre Pichet -

Taking care to use shortanswer and not numerical question ....

Average of ratings: Useful (1)