소스 검색

Fix bug in Fill the text question, if there is a / in the text to find

Hubert Borderiou 12 년 전
부모
커밋
ffd8c0c567
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      main/exercice/exercise.lib.php

+ 2 - 1
main/exercice/exercise.lib.php

@@ -419,7 +419,8 @@ function showQuestion($questionId, $only_questions = false, $origin = false, $cu
 				            if (!empty($value[0])) {				            	
 				            	$value = str_replace(' ', '',  trim($value[0]));                                
 				            }                                
-                            $correct_item = preg_quote($correct_item);                            
+                            $correct_item = preg_quote($correct_item);
+                            $correct_item = api_preg_replace('|/|', '\/', $correct_item);   // to prevent error if there is a / in the text to find
 				            $answer = api_preg_replace('/'.$correct_item.'/', Display::input('text', "choice[$questionId][]", $value), $answer);                            
                             //$answer = api_preg_replace('/\['.$correct_item.'+\]/', Display::input('text', "choice[$questionId][]", $value), $answer);	
 				        }