Skip to content

Commit

Permalink
MDL-20296 add isset() tests in function split_old_answer () lines 358…
Browse files Browse the repository at this point in the history
…-362
  • Loading branch information
ppichet committed Jun 4, 2010
1 parent 5e97c34 commit 49580a5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions question/type/numerical/questiontype.php
Expand Up @@ -356,8 +356,12 @@ function split_old_answer($rawresponse, $units, &$answer ,&$unit ) {
$rawresponse = str_replace($search, $replace, trim($rawresponse));
if (preg_match('~^([+-]?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)([eE][-+]?[0-9]+)?)([^0-9].*)?$~',
$rawresponse, $responseparts)) {
$unit = $responseparts[5] ;
$answer = $responseparts[1] ;
if(isset($responseparts[5]) ){
$unit = $responseparts[5] ;
}
if(isset($responseparts[1]) ){
$answer = $responseparts[1] ;
}
}
return ;
}
Expand Down

0 comments on commit 49580a5

Please sign in to comment.