Skip to content

Commit

Permalink
Possible fix to issue #339.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Sangwin authored and Chris Sangwin committed Jan 5, 2018
1 parent 4b08215 commit 2aa1cb1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions stack/input/inputbase.class.php
Expand Up @@ -210,6 +210,12 @@ protected function validate_extra_options() {
}
break;

case 'mul':
if (!(is_bool($arg))) {
$this->errors[] = stack_string('numericalinputoptbooplerr', array('opt' => $option, 'val' => $arg));
}
break;

case 'mindp':
if (!($arg === false || is_numeric($arg))) {
$this->errors[] = stack_string('numericalinputoptinterr', array('opt' => $option, 'val' => $arg));
Expand Down
6 changes: 4 additions & 2 deletions stack/input/units/units.class.php
Expand Up @@ -31,6 +31,8 @@ class stack_units_input extends stack_input {
*/
protected $extraoptions = array(
'negpow' => false,
// Automatically replace stackunits with * for the PRTs. Legacy questions only really.
'mul' => false,
// Require min/max number of decimal places?
'mindp' => false,
'maxdp' => false,
Expand Down Expand Up @@ -99,9 +101,9 @@ public static function get_parameters_defaults() {
'lowestTerms' => true,
// The sameType option is ignored by this input type.
// The answer is essantially required to be a number and units, other types are rejected.
'sameType' => false,
'sameType' => false,
// Currently this can only be "negpow", or "mul".
'options' => '',
'options' => '',
);
}

Expand Down

0 comments on commit 2aa1cb1

Please sign in to comment.