diff --git a/lib/pear/HTML/QuickForm/Rule/Compare.php b/lib/pear/HTML/QuickForm/Rule/Compare.php
index 594e51c4443..74950b294c2 100644
--- a/lib/pear/HTML/QuickForm/Rule/Compare.php
+++ b/lib/pear/HTML/QuickForm/Rule/Compare.php
@@ -71,13 +71,16 @@ class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule
function validate($values, $operator = null)
{
$operator = $this->_findOperator($operator);
- if ('==' != $operator && '!=' != $operator) {
- $compareFn = create_function('$a, $b', 'return floatval($a) ' . $operator . ' floatval($b);');
+ $a = $values[0];
+ $b = $values[1];
+ if ($operator == '==') {
+ return $a == $b;
+ } else if ($operator == '!=') {
+ return $a != $b;
} else {
- $compareFn = create_function('$a, $b', 'return $a ' . $operator . ' $b;');
+ // One of: <= , >= , < , > .
+ return eval('return ' . floatval($a) . $operator . floatval($b) . ';');
}
-
- return $compareFn($values[0], $values[1]);
}
diff --git a/lib/pear/HTML/QuickForm/date.php b/lib/pear/HTML/QuickForm/date.php
index c0090e49993..e6ff7f87b03 100644
--- a/lib/pear/HTML/QuickForm/date.php
+++ b/lib/pear/HTML/QuickForm/date.php
@@ -351,14 +351,18 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
$this->_options['maxYear'],
$this->_options['minYear'] > $this->_options['maxYear']? -1: 1
);
- array_walk($options, create_function('&$v,$k','$v = substr($v,-2);'));
+ array_walk($options, function(&$v, $k) {
+ $v = substr($v, -2);
+ });
break;
case 'h':
$options = $this->_createOptionList(1, 12);
break;
case 'g':
$options = $this->_createOptionList(1, 12);
- array_walk($options, create_function('&$v,$k', '$v = intval($v);'));
+ array_walk($options, function(&$v, $k) {
+ $v = intval($v);
+ });
break;
case 'H':
$options = $this->_createOptionList(0, 23);
diff --git a/lib/pear/PEAR.php b/lib/pear/PEAR.php
index 4e7c901db2e..295bb1e18c4 100644
--- a/lib/pear/PEAR.php
+++ b/lib/pear/PEAR.php
@@ -759,7 +759,7 @@ function _PEAR_call_destructors()
$_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
}
- while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
+ foreach ($_PEAR_destructor_object_list as $k => $objref) {
$classname = get_class($objref);
while ($classname) {
$destructor = "_$classname";
diff --git a/lib/pear/README_MOODLE.txt b/lib/pear/README_MOODLE.txt
index ec62936d8fd..05043accf5c 100644
--- a/lib/pear/README_MOODLE.txt
+++ b/lib/pear/README_MOODLE.txt
@@ -32,12 +32,15 @@ MDL-52826 - Remove onsubmit events pointing to the global validation functions a
tag moved after the HTML
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
Pear
====
-Changed constructors in classes PEAR and PEAR_ERROR to be __construct(). This has
-been already changed upstream in 1.10.0, remove this line after upgrade.
+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
Crypt/CHAP