1
Older versions / DataObject->validateMaxValueOf($column, $max) bug
« on: March 02, 2010, 11:29:20 am »
I'm pretty sure that there is a small bug in the DataObject->validateMaxValueOf($column, $max) function. (line 1108 of DataObject.class.php in environment/classes/dataaccess)
The problem is that the function does not work when validating ints and floats (however it does work with string), the reason is that in the code the wrong variables are being compared
line 1114 onwards reads:
// Get value...
$value = $this->getColumnValue($column);
// Integer and float...
if(is_int($value) || is_float($column)) {
return $column <= $max;
}
line 1118 should read:
if(is_int($value) || is_float($value)) {
return $value <= $max;
}
not:
if(is_int($value) || is_float($column)) {
return $column <= $max;
}
This same error (comparing a column name to an integer) is repeated on lines 1126, and again in the function validateMinValueOf lines 1149 and line 1157
hope this helps
bug applies to version 1.6.2
The problem is that the function does not work when validating ints and floats (however it does work with string), the reason is that in the code the wrong variables are being compared
line 1114 onwards reads:
// Get value...
$value = $this->getColumnValue($column);
// Integer and float...
if(is_int($value) || is_float($column)) {
return $column <= $max;
}
line 1118 should read:
if(is_int($value) || is_float($value)) {
return $value <= $max;
}
not:
if(is_int($value) || is_float($column)) {
return $column <= $max;
}
This same error (comparing a column name to an integer) is repeated on lines 1126, and again in the function validateMinValueOf lines 1149 and line 1157
hope this helps
bug applies to version 1.6.2