Details

    • Testing Instructions:
      Hide
      1. Within a course, create a database activity
      2. Select the 'Presets' tab. Make sure there's no warning for setType().
      3. select 'import entries' link (db activity admin > import entries). Make sure there's no warning for setType()
      Show
      Within a course, create a database activity Select the 'Presets' tab. Make sure there's no warning for setType(). select 'import entries' link (db activity admin > import entries). Make sure there's no warning for setType()
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      48988

      Description

      I found a few setType() warnings in the Database activity module.

      The Preset tab shows the following warnings...

      Did you remember to call setType() for 'd'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 85 of \mod\data\preset.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'action'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 85 of \mod\data\preset.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'd'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 88 of \mod\data\preset.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'action'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 88 of \mod\data\preset.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'd'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 91 of \mod\data\preset.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'action'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 91 of \mod\data\preset.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'd'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 94 of \mod\data\preset.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'action'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 94 of \mod\data\preset.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'd'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 245 of \mod\data\preset.php: call to moodleform->display()
      
      Did you remember to call setType() for 'action'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 245 of \mod\data\preset.php: call to moodleform->display()
      
      Did you remember to call setType() for 'd'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 246 of \mod\data\preset.php: call to moodleform->display()
      
      Did you remember to call setType() for 'action'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 246 of \mod\data\preset.php: call to moodleform->display()
      
      Did you remember to call setType() for 'd'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 250 of \mod\data\preset.php: call to moodleform->display()
      
      Did you remember to call setType() for 'action'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 250 of \mod\data\preset.php: call to moodleform->display()
      
      Did you remember to call setType() for 'd'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 251 of \mod\data\preset.php: call to moodleform->display()
      
      Did you remember to call setType() for 'action'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 251 of \mod\data\preset.php: call to moodleform->display()
      

      The import entries page shows...

      Did you remember to call setType() for 'fieldenclosure'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 67 of \mod\data\import.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'fieldenclosure'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 281 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 202 of \lib\formslib.php: call to moodleform->_process_submission()
          line 85 of \mod\data\import.php: call to moodleform->moodleform()
      
      Did you remember to call setType() for 'fieldenclosure'? Defaulting to PARAM_RAW cleaning.
      
          line 1291 of \lib\formslib.php: call to debugging()
          line 919 of \lib\formslib.php: call to moodleform->detectMissingSetType()
          line 89 of \mod\data\import.php: call to moodleform->display()
      

        Activity

        Hide
        Adrian Greeve added a comment -

        Sorry Rosie,

        I had a closer look at this today and there are a few things to consider.

        • 'fieldenclosure' should be PARAM_CLEANHTML to agree with import.php
        • 'd' (one of the worst variable names so far) is actually the database activity id and should be PARAM_INT.
        • 'activity' looks fine and can stay as PARAM_TEXT

        Once you have changed those over feel free to submit for integration.

        Show
        Adrian Greeve added a comment - Sorry Rosie, I had a closer look at this today and there are a few things to consider. 'fieldenclosure' should be PARAM_CLEANHTML to agree with import.php 'd' (one of the worst variable names so far) is actually the database activity id and should be PARAM_INT. 'activity' looks fine and can stay as PARAM_TEXT Once you have changed those over feel free to submit for integration.
        Hide
        Rossiani Wijaya added a comment -

        Hi Adrian.

        Thanks for reviewing.

        I have the hunch that 'd' is an int for ID, but wasn't sure since it displayed as 1 when I checked on my site. Thanks for clearing it up.

        Patch updated.

        Submitting for integration review.

        Rosie

        Show
        Rossiani Wijaya added a comment - Hi Adrian. Thanks for reviewing. I have the hunch that 'd' is an int for ID, but wasn't sure since it displayed as 1 when I checked on my site. Thanks for clearing it up. Patch updated. Submitting for integration review. Rosie
        Hide
        Dan Poltawski added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        TIA and ciao

        Show
        Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
        Hide
        Rossiani Wijaya added a comment -

        patch updated

        Show
        Rossiani Wijaya added a comment - patch updated
        Hide
        Dan Poltawski added a comment -

        Hi Rosie,

        It looks good apart from 'action'.

        I don't think that action pass the test of 'This is expected to be text with mutlilang content'.

        I think that you want PARAM_ALPHA.

        Show
        Dan Poltawski added a comment - Hi Rosie, It looks good apart from 'action'. I don't think that action pass the test of 'This is expected to be text with mutlilang content'. I think that you want PARAM_ALPHA.
        Hide
        CiBoT added a comment -

        Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.

        Show
        CiBoT added a comment - Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.
        Hide
        Rossiani Wijaya added a comment -

        Hi Dan,

        Thanks for reviewing.

        One of the action value is "save2". If we use PARAM_ALPHA, it will truncate the numeric value right?

        Should it used PARAM_ALPHANUM instead?

        Show
        Rossiani Wijaya added a comment - Hi Dan, Thanks for reviewing. One of the action value is "save2". If we use PARAM_ALPHA, it will truncate the numeric value right? Should it used PARAM_ALPHANUM instead?
        Hide
        Rossiani Wijaya added a comment -

        Updated the patch to use PARAM_ALPHA for actions except for action with a value of 'save2', which is set to use PARAM_ALPHANUM.

        Show
        Rossiani Wijaya added a comment - Updated the patch to use PARAM_ALPHA for actions except for action with a value of 'save2', which is set to use PARAM_ALPHANUM.
        Hide
        Dan Poltawski added a comment -

        Yes, ideally you'd use PARAM_ALPHANUM for all the params, my mistake (or alphanumext)

        Show
        Dan Poltawski added a comment - Yes, ideally you'd use PARAM_ALPHANUM for all the params, my mistake (or alphanumext)
        Hide
        Rossiani Wijaya added a comment -

        Hi Dan,

        I updated the patch to use PARAM_ALPHANUM for action field and optional_param().

        Resubmitting for integration.

        Show
        Rossiani Wijaya added a comment - Hi Dan, I updated the patch to use PARAM_ALPHANUM for action field and optional_param(). Resubmitting for integration.
        Hide
        Dan Poltawski added a comment -

        Thanks Rosie, i've integrated that to master now.

        Show
        Dan Poltawski added a comment - Thanks Rosie, i've integrated that to master now.
        Hide
        Rajesh Taneja added a comment -

        Thanks for fixing this Rossie,

        No setType warnings appear on DB import and presets page.

        Show
        Rajesh Taneja added a comment - Thanks for fixing this Rossie, No setType warnings appear on DB import and presets page.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        I feel myself really alone tonight! So was time to push your fixes upstream!

        "Lest we forget. We will remember them."

        Thanks and ciao!

        Show
        Eloy Lafuente (stronk7) added a comment - I feel myself really alone tonight! So was time to push your fixes upstream! "Lest we forget. We will remember them." Thanks and ciao!

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: