Details

    • Rank:
      48933

      Description

      While working on MDL-38735 I visited various admin-tree pages (register, hubs...) and some of them were showing the "setType()" debugging message.

      This is about to visit the whole admin tree, adding every missing type.

      Ciao

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          This review should include all settings pages, including those for plugins that are turned off by default.

          Show
          Michael de Raadt added a comment - This review should include all settings pages, including those for plugins that are turned off by default.
          Hide
          Dan Poltawski added a comment -

          Hi Raj,

          I've only skimmed - so leaving for other reviewers, but please be careful about PARAM_TEXT. Its not plain text, its text which includes multilang content (heavily misunderstood, by myself included). See Petr's comments:
          https://tracker.moodle.org/browse/MDL-34311?focusedCommentId=210794&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-210794

          (If the answer to the question 'Does this field expect multilang content?' is no, then in general its the wrong param type).

          Show
          Dan Poltawski added a comment - Hi Raj, I've only skimmed - so leaving for other reviewers, but please be careful about PARAM_TEXT. Its not plain text, its text which includes multilang content (heavily misunderstood, by myself included). See Petr's comments: https://tracker.moodle.org/browse/MDL-34311?focusedCommentId=210794&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-210794 (If the answer to the question 'Does this field expect multilang content?' is no, then in general its the wrong param type).
          Hide
          Rajesh Taneja added a comment -

          Aha, Thanks Dan, I will fix this.

          What is the best PARAM type for "This/Or/NOT.A.Value" (string with slashes and .) ?

          Show
          Rajesh Taneja added a comment - Aha, Thanks Dan, I will fix this. What is the best PARAM type for "This/Or/NOT.A.Value" (string with slashes and .) ?
          Hide
          Jason Fowler added a comment -

          you are changing the default value from true to 0 (false) for a few of the boolean options. is there a reason for this?

          Show
          Jason Fowler added a comment - you are changing the default value from true to 0 (false) for a few of the boolean options. is there a reason for this?
          Hide
          Jason Fowler added a comment -

          Other than that one little query, the code looks fine, and should be pushed for integration once the query is answered.

          Show
          Jason Fowler added a comment - Other than that one little query, the code looks fine, and should be pushed for integration once the query is answered.
          Hide
          Rajesh Taneja added a comment -

          Thanks Dan and Jason,

          I have updated the patch and used PARAM_TEXT where required (like description etc.)

          FYI: setType() in registration section is quite messy and I tried to replicate same type as on https://github.com/moodlehq/moodle-local_hub
          although for few elements I have used INT (courses, users etc.), because hub code internally modifies it to int.

          Show
          Rajesh Taneja added a comment - Thanks Dan and Jason, I have updated the patch and used PARAM_TEXT where required (like description etc.) FYI: setType() in registration section is quite messy and I tried to replicate same type as on https://github.com/moodlehq/moodle-local_hub although for few elements I have used INT (courses, users etc.), because hub code internally modifies it to int.
          Hide
          Jason Fowler added a comment -

          All good Raj, looks great.

          Show
          Jason Fowler added a comment - All good Raj, looks great.
          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
          Damyon Wiese added a comment -

          Thanks Raj, almost there!

          PARAM_TEXT should not be used for hub_selector+site_registration_form password fields.

          Show
          Damyon Wiese added a comment - Thanks Raj, almost there! PARAM_TEXT should not be used for hub_selector+site_registration_form password fields.
          Hide
          Rajesh Taneja added a comment -

          Thanks Damyon,

          I have integrate your suggestion, although it's different from what's on hub/siteregistration.php

          Show
          Rajesh Taneja added a comment - Thanks Damyon, I have integrate your suggestion, although it's different from what's on hub/siteregistration.php
          Hide
          Damyon Wiese added a comment -

          Thanks Raj,

          This has been integrated to master now.

          Cheers!

          Show
          Damyon Wiese added a comment - Thanks Raj, This has been integrated to master now. Cheers!
          Hide
          Rossiani Wijaya added a comment -

          Hi Raj,

          I found more setType() notices:

          boxnet portfolio:
          Did you remember to call setType() for 'apikey'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 77 of /admin/portfolio.php: call to moodleform->moodleform()

          flickr portfolio
          Did you remember to call setType() for 'apikey'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 77 of /admin/portfolio.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'sharedsecret'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 77 of /admin/portfolio.php: call to moodleform->moodleform()

          Webservice - create token:
          Did you remember to call setType() for 'iprestriction'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 55 of /admin/webservice/tokens.php: call to moodleform->moodleform()

          Webservice - create token: (modifying the $usertotal test. eg: 5) (/admin/webservice/forms.php line 214)
          Did you remember to call setType() for 'user'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 55 of /admin/webservice/tokens.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'iprestriction'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 55 of /admin/webservice/tokens.php: call to moodleform->moodleform()

          Site admin > development > web service test client
          Did you remember to call setType() for 'wsusername'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'wspassword'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'name'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'parent'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'idnumber'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'description'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'name'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'parent'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'idnumber'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Did you remember to call setType() for 'description'? Defaulting to PARAM_RAW cleaning.

          line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          I also found this line but couldn't find it on the site.
          /cache/forms.php line 72 (hidden field for lock).

          Please let me know if you want to fix the above notices on separate issue or part of this.

          Rosie

          Show
          Rossiani Wijaya added a comment - Hi Raj, I found more setType() notices: boxnet portfolio: Did you remember to call setType() for 'apikey'? Defaulting to PARAM_RAW cleaning. line 1289 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 77 of /admin/portfolio.php: call to moodleform->moodleform() flickr portfolio Did you remember to call setType() for 'apikey'? Defaulting to PARAM_RAW cleaning. line 1289 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 77 of /admin/portfolio.php: call to moodleform->moodleform() Did you remember to call setType() for 'sharedsecret'? Defaulting to PARAM_RAW cleaning. line 1289 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 77 of /admin/portfolio.php: call to moodleform->moodleform() Webservice - create token: Did you remember to call setType() for 'iprestriction'? Defaulting to PARAM_RAW cleaning. line 1289 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 55 of /admin/webservice/tokens.php: call to moodleform->moodleform() Webservice - create token: (modifying the $usertotal test. eg: 5) (/admin/webservice/forms.php line 214) Did you remember to call setType() for 'user'? Defaulting to PARAM_RAW cleaning. line 1289 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 55 of /admin/webservice/tokens.php: call to moodleform->moodleform() Did you remember to call setType() for 'iprestriction'? Defaulting to PARAM_RAW cleaning. line 1289 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 55 of /admin/webservice/tokens.php: call to moodleform->moodleform() Site admin > development > web service test client Did you remember to call setType() for 'wsusername'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'wspassword'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'name'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'parent'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'idnumber'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'description'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'name'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'parent'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'idnumber'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() Did you remember to call setType() for 'description'? Defaulting to PARAM_RAW cleaning. line 1289 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 112 of /admin/webservice/testclient.php: call to moodleform->moodleform() I also found this line but couldn't find it on the site. /cache/forms.php line 72 (hidden field for lock). Please let me know if you want to fix the above notices on separate issue or part of this. Rosie
          Hide
          Rajesh Taneja added a comment -

          Thanks Rossie,

          I think this is a separate issue, as these elements are added via repository/lib (repository/flickr/lib.php).
          It should have been fixed by MDL-38852.

          Show
          Rajesh Taneja added a comment - Thanks Rossie, I think this is a separate issue, as these elements are added via repository/lib (repository/flickr/lib.php). It should have been fixed by MDL-38852 .
          Hide
          Rajesh Taneja added a comment -

          Hello Damyon,

          I have added two more commits to fix setType notice in webservice and portfolio.

          Can you please pull them for testing.

          Show
          Rajesh Taneja added a comment - Hello Damyon, I have added two more commits to fix setType notice in webservice and portfolio. Can you please pull them for testing.
          Hide
          Damyon Wiese added a comment -

          Hi Raj, one more thing about your extra patches.

          You changed

          • $mform->setType('function', PARAM_SAFEDIR);
            + $mform->setType('function', PARAM_ALPHAEXT);

          For the other fields the change looks Ok - but for functions specifically, this change will make previously working functions fail if they contain numbers. E.g. "xbox360_post_achievement" or something.

          Show
          Damyon Wiese added a comment - Hi Raj, one more thing about your extra patches. You changed $mform->setType('function', PARAM_SAFEDIR); + $mform->setType('function', PARAM_ALPHAEXT); For the other fields the change looks Ok - but for functions specifically, this change will make previously working functions fail if they contain numbers. E.g. "xbox360_post_achievement" or something.
          Hide
          Rajesh Taneja added a comment -

          Thanks Damyon,

          As discussed, I have changed it to PARAM_PLUGIN.

          Show
          Rajesh Taneja added a comment - Thanks Damyon, As discussed, I have changed it to PARAM_PLUGIN.
          Hide
          Damyon Wiese added a comment -

          Thanks Raj - I've pushed the extra commits to master now - ready to retest.

          Show
          Damyon Wiese added a comment - Thanks Raj - I've pushed the extra commits to master now - ready to retest.
          Hide
          Rossiani Wijaya added a comment -

          Thanks Raj and Damyon,

          This is work as expected.

          Tested for master

          Test passed.

          Show
          Rossiani Wijaya added a comment - Thanks Raj and Damyon, This is work as expected. Tested for master Test passed.
          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!
          Hide
          Robert Russo added a comment -

          Grade export plain text file:

          Did you remember to call setType() for 'iprestriction'? Defaulting to PARAM_RAW cleaning.
          line 1303 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 43 of /grade/export/txt/index.php: call to moodleform->moodleform()

          Show
          Robert Russo added a comment - Grade export plain text file: Did you remember to call setType() for 'iprestriction'? Defaulting to PARAM_RAW cleaning. line 1303 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 43 of /grade/export/txt/index.php: call to moodleform->moodleform()
          Hide
          Rajesh Taneja added a comment -

          Thanks for reporting this Robert,

          I have created MDL-40469, so as to resolve this problem.

          Show
          Rajesh Taneja added a comment - Thanks for reporting this Robert, I have created MDL-40469 , so as to resolve this problem.
          Hide
          Mahmoud Kassaei added a comment -

          I also came across the same issue in Moodle 2.6.1 which we currentl using at the OU

          Did you remember to call setType() for 'token'? Defaulting to PARAM_RAW cleaning.

          line 1318 of /lib/formslib.php: call to debugging()
          line 282 of /lib/formslib.php: call to moodleform->detectMissingSetType()
          line 202 of /lib/formslib.php: call to moodleform->_process_submission()
          line 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()

          Show
          Mahmoud Kassaei added a comment - I also came across the same issue in Moodle 2.6.1 which we currentl using at the OU Did you remember to call setType() for 'token'? Defaulting to PARAM_RAW cleaning. line 1318 of /lib/formslib.php: call to debugging() line 282 of /lib/formslib.php: call to moodleform->detectMissingSetType() line 202 of /lib/formslib.php: call to moodleform->_process_submission() line 112 of /admin/webservice/testclient.php: call to moodleform->moodleform()
          Hide
          Rajesh Taneja added a comment -

          Hello Mahmoud,

          Can you please let me know which webservice function you are trying to test.

          Show
          Rajesh Taneja added a comment - Hello Mahmoud, Can you please let me know which webservice function you are trying to test.
          Hide
          Mahmoud Kassaei added a comment -

          Hi Rajesh,
          I have been testing a local plugin which I have written almost 3 years ago and it has been working since. We check our plugins after merging to a new version of Moodle core and this time (merging to 2.6.1) I came across the above warning.

          Thanks to your question, I found out that I did not set the types of my form elements and since Moodle has improved and checking the form thoroughly, we get the warning. I found the three field which need their types to ber set and it it now sorted.

          Thanks again and please ignore my previous comment.

          BTW, looking at this issue the same problem seems to occur in other forms.
          From the line 112 in /admin/webservice/testclient.php

          $mform = new $class(null, array('authmethod' => $authmethod));

          I had to backtrack the $class and found that the problem was in my plugin's form.

          Show
          Mahmoud Kassaei added a comment - Hi Rajesh, I have been testing a local plugin which I have written almost 3 years ago and it has been working since. We check our plugins after merging to a new version of Moodle core and this time (merging to 2.6.1) I came across the above warning. Thanks to your question, I found out that I did not set the types of my form elements and since Moodle has improved and checking the form thoroughly, we get the warning. I found the three field which need their types to ber set and it it now sorted. Thanks again and please ignore my previous comment. BTW, looking at this issue the same problem seems to occur in other forms. From the line 112 in /admin/webservice/testclient.php $mform = new $class(null, array('authmethod' => $authmethod)); I had to backtrack the $class and found that the problem was in my plugin's form.
          Hide
          Rajesh Taneja added a comment -

          Great, Thanks for the update Mahmoud.

          Show
          Rajesh Taneja added a comment - Great, Thanks for the update Mahmoud.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: