Skip to content

Commit e8aba6f

Browse files
committed
Add function visibility + fix PHP warning.
1 parent 2f14ce1 commit e8aba6f

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

main/inc/lib/formvalidator/Rule/CompareFields.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ class HTML_QuickForm_Compare_Fields extends HTML_QuickForm_Rule_Compare
1313
* @param string the value to compare
1414
* @return boolean True if date is valid
1515
*/
16-
function validate($values = [], $operator_and_max_value = null)
16+
public function validate($values = [], $operator_and_max_value = null)
1717
{
1818
if (is_array($values) && !empty($values) && !empty($operator_and_max_value)) {
1919
$final_value = 0;
2020
foreach ($values as $value) {
21+
$value = (float) $value;
2122
$final_value += $value;
2223
}
2324
$params = explode('@', $operator_and_max_value);
@@ -29,4 +30,4 @@ function validate($values = [], $operator_and_max_value = null)
2930

3031
return false;
3132
}
32-
}
33+
}

main/inc/lib/pear/HTML/QuickForm/Rule.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
32

43
/**
54
* Abstract base class for QuickForm validation rules
@@ -42,7 +41,7 @@ class HTML_QuickForm_Rule
4241
* @var string
4342
* @access public
4443
*/
45-
var $name;
44+
public $name;
4645

4746
/**
4847
* Validates a value
@@ -78,4 +77,4 @@ function getValidationScript($options = null)
7877
{
7978
return array('', '');
8079
}
81-
}
80+
}

main/inc/lib/pear/HTML/QuickForm/Rule/Compare.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function _findOperator($name)
7676
* @param string $operator
7777
* @return mixed
7878
*/
79-
function validate($values, $operator = null)
79+
public function validate($values, $operator = null)
8080
{
8181
$operator = $this->_findOperator($operator);
8282
if ('===' != $operator && '!==' != $operator) {
@@ -87,8 +87,7 @@ function validate($values, $operator = null)
8787
return $compareFn($values[0], $values[1]);
8888
}
8989

90-
91-
function getValidationScript($operator = null)
90+
public function getValidationScript($operator = null)
9291
{
9392
$operator = $this->_findOperator($operator);
9493
if ('===' != $operator && '!==' != $operator) {

0 commit comments

Comments
 (0)