From 78855e618ceaa9b53fae0edb188d2f216aca792c Mon Sep 17 00:00:00 2001 From: Kordan Date: Thu, 28 Jan 2021 08:53:04 +0100 Subject: [PATCH] MDL-70711 form: deleted useless if block get_magic_quotes_gpc() always return false since PHP 5.3 so (1 == get_magic_quotes_gpc()) is never verified. This allows me to safetly delete what I dropped out. --- lib/pear/HTML/QuickForm.php | 17 ++--------------- lib/pear/README_MOODLE.txt | 6 ++++-- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/lib/pear/HTML/QuickForm.php b/lib/pear/HTML/QuickForm.php index 0207066f889..c0fb5b7fa9e 100644 --- a/lib/pear/HTML/QuickForm.php +++ b/lib/pear/HTML/QuickForm.php @@ -266,21 +266,8 @@ class HTML_QuickForm extends HTML_Common { $attributes = array('action'=>$action, 'method'=>$method, 'name'=>$formName, 'id'=>$formName) + $target; $this->updateAttributes($attributes); if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) { - 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; - } + $this->_submitValues = 'get' == $method? $_GET: $_POST; + $this->_submitFiles = $_FILES; $this->_flagSubmitted = count($this->_submitValues) > 0 || count($this->_submitFiles) > 0; } if ($trackSubmit) { diff --git a/lib/pear/README_MOODLE.txt b/lib/pear/README_MOODLE.txt index 062a8ae5c94..c89c646d940 100644 --- a/lib/pear/README_MOODLE.txt +++ b/lib/pear/README_MOODLE.txt @@ -21,11 +21,13 @@ MDL-52826 - Remove onsubmit events pointing to the global validation functions a MDL-50484 - _getPersistantData() returns id with _persistant prefixed to element id. MDL-55123 - corrected call to non-static functions in HTML_QuickForm to be PHP7.1-compliant MDL-60281 - replaced deprecated create_function() with lambda functions for PHP7.2 compatibility - +MDL-70711 - removed unnecessary if-else conditional block in HTML_QuickForm as the given + condition always evaluates to false due to the deprecated get_magic_quotes_gpc() + which always returns false Pear ==== -It was decided that we will not upgrade this library from upstream any more, see MDL-52465 +It was decided that we will not upgrade this library from upstream any more, see MDL-52465 Changed constructors in classes PEAR and PEAR_ERROR to be __construct(). MDL-60281 - replaced deprecated function each() with foreach loop for PHP7.2 compatibility