-
Bug
-
Resolution: Fixed
-
Major
-
3.9.4, 3.10.1, 3.11, 4.0
-
MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
-
MOODLE_310_STABLE, MOODLE_39_STABLE
-
MDL-70711-master -
Trying to add a select with few disabled items to a form I went to read moodle documentation.
I arrived in: https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#select
and I found the sentence: "It is also possible to create a select with certain options disabled, using this technique"
Following the link I arrived to:
http://stackoverflow.com/questions/2138089/how-can-i-use-quickform-to-add-disabled-select-options/2150275#2150275
I did what was suggested and now I have a code starting with:
$quickform = new HTML_QuickForm();
Running it I get in the following error:
Exception - Unknown error type: Function get_magic_quotes_gpc() is deprecated in [dirroot]/lib/pear/HTML/QuickForm.php on line 269
|
More information about this error
|
Debug info:
|
Error code: generalexceptionmessage
|
Stack trace:
|
line 158 of /lib/behat/lib.php: Exception thrown
|
line 269 of /lib/pear/HTML/QuickForm.php: call to behat_error_handler()
|
line 239 of /mod/surveypro/form/items/itembase_form.php: call to HTML_QuickForm->__construct()
|
line 47 of /mod/surveypro/format/fieldset/form/itemsetup_form.php: call to mod_surveypro_itembaseform->definition()
|
line 214 of /lib/formslib.php: call to mod_surveypro_fieldset_setupform->definition()
|
line 112 of /mod/surveypro/layout_itemsetup.php: call to moodleform->__construct()
|
(if you want to see my code you can get it in: https://github.com/kordan/moodle-mod_surveypro/blob/master/form/items/itembase_form.php#L239)
I found in: https://stackoverflow.com/questions/61054418/php-7-4-deprecated-get-magic-quotes-gpc-function-alternative
that I should remove every mention of get_magic_quotes_gpc() but I think this is not something I can.
In spite of this, I found that if I change from line 269 in lib/pear/HTML/QuickForm.php
from
if (1 == get_magic_quotes_gpc()) { |
$this->_submitValues = ('get' == $method? $_GET: $_POST); // we already eliminated magic quotes in moodle setup.php |
foreach ($_FILES as $keyFirst => $valFirst) {
|
foreach ($valFirst as $keySecond => $valSecond) {
|
if ('name' == $keySecond) { |
$this->_submitFiles[$keyFirst][$keySecond] = $valSecond; // we already eliminated magic quotes in moodle setup.php |
} else { |
$this->_submitFiles[$keyFirst][$keySecond] = $valSecond; |
}
|
}
|
}
|
} else { |
$this->_submitValues = 'get' == $method? $_GET: $_POST; |
$this->_submitFiles = $_FILES; |
}
|
to
// if (1 == get_magic_quotes_gpc()) { |
// $this->_submitValues = ('get' == $method? $_GET: $_POST); // we already eliminated magic quotes in moodle setup.php |
// foreach ($_FILES as $keyFirst => $valFirst) { |
// foreach ($valFirst as $keySecond => $valSecond) { |
// if ('name' == $keySecond) { |
// $this->_submitFiles[$keyFirst][$keySecond] = $valSecond; // we already eliminated magic quotes in moodle setup.php |
// } else { |
// $this->_submitFiles[$keyFirst][$keySecond] = $valSecond; |
// } |
// } |
// } |
// } else { |
$this->_submitValues = 'get' == $method? $_GET: $_POST; |
$this->_submitFiles = $_FILES; |
// } |
all works fine again.
AFAIK get_magic_quotes_gpc() always return false so (1 == get_magic_quotes_gpc()) is never verified.
Is this a bug?