Non-core contributed modules

notice and sql errors in questionnaire module

Details

  • Database:
    PostgreSQL
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

On View survey initially:

Notice: Trying to get property of non-object in
/oci/openlearn-wwwrootacct/mod/questionnaire/locallib.php on line 536

ERROR: invalid input syntax for integer: ""

SELECT * FROM mdl_user WHERE id = ''
line 779 of lib/dmllib.php: call to debugging()
line 576 of lib/dmllib.php: call to get_recordset_sql()
line 516 of lib/dmllib.php: call to get_record_sql()
line 739 of mod/questionnaire/locallib.php: call to get_record()
line 712 of mod/questionnaire/locallib.php: call to
questionnaire->print_survey_start()
line 667 of mod/questionnaire/locallib.php: call to
questionnaire->survey_render()
line 266 of mod/questionnaire/locallib.php: call to
questionnaire->print_survey()
line 52 of mod/questionnaire/view.php: call to questionnaire->view()

Notice: Undefined variable: resp in
/oci/openlearn-wwwrootacct/mod/questionnaire/locallib.php on line 746

Notice: Trying to get property of non-object in
/oci/openlearn-wwwrootacct/mod/questionnaire/locallib.php on line 746

On submit survey:

Notice: Undefined variable: message in /oci/openlearn-wwwrootacct/mod/questionnaire/locallib.php on line 1394

On clicking All responses button:

ERROR: column "qc.content" must appear in the GROUP BY clause or be used in an aggregate function

SELECT qc.id, qc.content, COUNT(rt.response_id) AS num FROM mdl_questionnaire_question_choice qc, mdl_questionnaire_response_single rt WHERE qc.question_id=5467 AND qc.content NOT LIKE '!other%' AND rt.question_id=qc.question_id AND rt.choice_id=qc.id AND response_id IN (455) GROUP BY qc.id

line 779 of lib/dmllib.php: call to debugging()
line 1020 of lib/dmllib.php: call to get_recordset_sql()
line 506 of mod/questionnaire/questiontypes/questiontypes.class.php: call to get_records_sql()
line 720 of mod/questionnaire/questiontypes/questiontypes.class.php: call to questionnaire_question->get_response_single_results()
line 627 of mod/questionnaire/questiontypes/questiontypes.class.php: call to questionnaire_question->display_response_single_results()
line 2376 of mod/questionnaire/locallib.php: call to questionnaire_question->display_results()
line 50 of mod/questionnaire/results.inc: call to questionnaire->survey_results()
line 343 of mod/questionnaire/report.php: call to include()

View by Response

ERROR: invalid input syntax for integer: "Anonymous"

SELECT * FROM mdl_user WHERE id = 'Anonymous'

line 779 of lib/dmllib.php: call to debugging()
line 576 of lib/dmllib.php: call to get_recordset_sql()
line 516 of lib/dmllib.php: call to get_record_sql()
line 2105 of mod/questionnaire/locallib.php: call to get_record()
line 28 of mod/questionnaire/results.inc: call to questionnaire->survey_results_navbar()
line 343 of mod/questionnaire/report.php: call to include()

Plus the same issue at lines 2096 and 739

  1. locallib.php
    30/Jul/07 7:32 PM
    107 kB
    Jenny Gray
  2. questiontypes.class.php
    30/Jul/07 7:36 PM
    72 kB
    Jenny Gray

Activity

Hide
Jenny Gray added a comment -

This fixes most of the issues, but because I'm not exactly sure of the purpose of each line, I'm not sure its doing it the right way!

It works for my use of the module anyway!

Show
Jenny Gray added a comment - This fixes most of the issues, but because I'm not exactly sure of the purpose of each line, I'm not sure its doing it the right way! It works for my use of the module anyway!
Hide
Jenny Gray added a comment -

And this fixes the group by error (for me at least)

Show
Jenny Gray added a comment - And this fixes the group by error (for me at least)
Hide
Jenny Gray added a comment -

Hum, sorry about this - just noticed another one.

Adding a new Questionnaire to topic 1
ERROR: invalid input syntax for integer: ""

SELECT * FROM mdl5_questionnaire_survey WHERE id = ''

line 779 of lib/dmllib.php: call to debugging()
line 576 of lib/dmllib.php: call to get_recordset_sql()
line 516 of lib/dmllib.php: call to get_record_sql()
line 103 of mod/questionnaire/mod.html: call to get_record()
line 743 of course/mod.php: call to include_once()

It seems to be because, on line 95-103 of mod/questionnaire/mod.html it is trying to do

if (!isset($form->sid)) { $form->sid = ""; }

/// Variable used to return from the phpESP Manager.
unset($_SESSION['qpage']);

/// If this questionnaire has a survey, get the survey and owner.
if ($survey = get_record('questionnaire_survey', 'id', $form->sid)) {

whereas it should presumably be bypassing the survey get_record if $form->sid is not set. I guess just adding $form->sid<>'' before the get_record call should fix it?

Show
Jenny Gray added a comment - Hum, sorry about this - just noticed another one. Adding a new Questionnaire to topic 1 ERROR: invalid input syntax for integer: "" SELECT * FROM mdl5_questionnaire_survey WHERE id = '' line 779 of lib/dmllib.php: call to debugging() line 576 of lib/dmllib.php: call to get_recordset_sql() line 516 of lib/dmllib.php: call to get_record_sql() line 103 of mod/questionnaire/mod.html: call to get_record() line 743 of course/mod.php: call to include_once() It seems to be because, on line 95-103 of mod/questionnaire/mod.html it is trying to do if (!isset($form->sid)) { $form->sid = ""; } /// Variable used to return from the phpESP Manager. unset($_SESSION['qpage']); /// If this questionnaire has a survey, get the survey and owner. if ($survey = get_record('questionnaire_survey', 'id', $form->sid)) { whereas it should presumably be bypassing the survey get_record if $form->sid is not set. I guess just adding $form->sid<>'' before the get_record call should fix it?
Hide
Jenny Gray added a comment -

OK, this is getting silly - is it my install that's making all these notices? One of my team has just reported a whole heap more - see below. I haven't had a chance to look at fixing these yet, because we don't make new questionnaires very often (we just roll out the same one on every course), so these are a low priority for me.

The following were displayed when I completed the first page of the
questionnaire (mod/edit) and selected the option to create a new survey
(mod/questionnaire/manage_survey.php

Notice: Trying to get property of non-object in
/var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 110

Notice: Undefined variable: mod in
/var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 111

Notice: Trying to get property of non-object in
/var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 111

Notice: Undefined variable: mod in
/var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 112

Notice: Trying to get property of non-object in
/var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 112

Error: Could not insert a new entry to the Moodle log

These appear to be because on lines 110-112 a logging statement has been copied
and pasted in that uses variables $course and $mod, which do not exist within
the current scope.

The following was within the same file:

Notice: Undefined property: questionnaire::$name in
/var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 257

I think perhaps this is because they have used an if($questionnaire->name)
instead of an if( isset($questionnaire->name) )

I then clicked on Edit Questions and it displayed:

Notice: Undefined property: object::$questionnaire_survey_id in
/var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 143

I'm not sure what's wrong here except that they are expecting the survey ID
to be in a $SESSION variable which it isn't - perhaps because it's a new
survey.

Notice: Undefined property: stdClass::$q in
/var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 231

Notice: Undefined property: stdClass::$extra_choices in
/var/www/html/gcm77/moodle5/mod/questionnaire/questions.inc on line 52

The form definition is possibly out of line with the code files?

Notice: Undefined variable: qcontent in
/var/www/html/gcm77/moodle5/mod/questionnaire/questions.inc on line 103

Possibly another case where isset should have been used, which I think also
applies to the following three.

Then, when I entered a question and saved it, it displayed this: I haven't
really looked into it.

Notice: Undefined property: stdClass::$extra_choices in
/var/www/html/gcm77/moodle5/mod/questionnaire/locallib.php on line 942

Show
Jenny Gray added a comment - OK, this is getting silly - is it my install that's making all these notices? One of my team has just reported a whole heap more - see below. I haven't had a chance to look at fixing these yet, because we don't make new questionnaires very often (we just roll out the same one on every course), so these are a low priority for me. The following were displayed when I completed the first page of the questionnaire (mod/edit) and selected the option to create a new survey (mod/questionnaire/manage_survey.php Notice: Trying to get property of non-object in /var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 110 Notice: Undefined variable: mod in /var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 111 Notice: Trying to get property of non-object in /var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 111 Notice: Undefined variable: mod in /var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 112 Notice: Trying to get property of non-object in /var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 112 Error: Could not insert a new entry to the Moodle log These appear to be because on lines 110-112 a logging statement has been copied and pasted in that uses variables $course and $mod, which do not exist within the current scope. The following was within the same file: Notice: Undefined property: questionnaire::$name in /var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 257 I think perhaps this is because they have used an if($questionnaire->name) instead of an if( isset($questionnaire->name) ) I then clicked on Edit Questions and it displayed: Notice: Undefined property: object::$questionnaire_survey_id in /var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 143 I'm not sure what's wrong here except that they are expecting the survey ID to be in a $SESSION variable which it isn't - perhaps because it's a new survey. Notice: Undefined property: stdClass::$q in /var/www/html/gcm77/moodle5/mod/questionnaire/manage_survey.php on line 231 Notice: Undefined property: stdClass::$extra_choices in /var/www/html/gcm77/moodle5/mod/questionnaire/questions.inc on line 52 The form definition is possibly out of line with the code files? Notice: Undefined variable: qcontent in /var/www/html/gcm77/moodle5/mod/questionnaire/questions.inc on line 103 Possibly another case where isset should have been used, which I think also applies to the following three. Then, when I entered a question and saved it, it displayed this: I haven't really looked into it. Notice: Undefined property: stdClass::$extra_choices in /var/www/html/gcm77/moodle5/mod/questionnaire/locallib.php on line 942
Hide
Mike Churchward added a comment -

Hi Jenny -

We'll eventually get rid of all the warnings. In the meantime, you can just set debug messages to 'NONE' in your 'Server/Debugging' settings.

Show
Mike Churchward added a comment - Hi Jenny - We'll eventually get rid of all the warnings. In the meantime, you can just set debug messages to 'NONE' in your 'Server/Debugging' settings.
Hide
Joseph Rézeau added a comment -

Please note that all "syntax minor errors" causing PHP warning notices have now been fixed in Questionnaire files in current version in HEAD (currently 1.9). Pending transfer to 1.8 and 1.7.
Joseph

Show
Joseph Rézeau added a comment - Please note that all "syntax minor errors" causing PHP warning notices have now been fixed in Questionnaire files in current version in HEAD (currently 1.9). Pending transfer to 1.8 and 1.7. Joseph
Hide
Joseph Rézeau added a comment -

Hopefully ALL PHP notices and warnings have now been fixed and committed to CVS in branches 1.7, 1.8, 1.9 and 2.0 (HEAD).
Closing bug.
Joseph

Show
Joseph Rézeau added a comment - Hopefully ALL PHP notices and warnings have now been fixed and committed to CVS in branches 1.7, 1.8, 1.9 and 2.0 (HEAD). Closing bug. Joseph

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: