MDL-37506 question code: incorrect preg_quote uses.

For preg_quote to work reliably, you must pass the delimiter you are
using for your regular expression. In many places we were failing to do
that.
This commit is contained in:
Tim Hunt
2013-01-18 11:18:54 +00:00
parent a5ec499521
commit 03cefcc91b
25 changed files with 73 additions and 73 deletions
+1 -1
View File
@@ -534,7 +534,7 @@ class question_attempt_step_subquestion_adapter extends question_attempt_step {
* null if the extre prefix was not present.
*/
public function remove_prefix($field) {
if (preg_match('~^(-?_?)' . preg_quote($this->extraprefix) . '(.*)$~', $field, $matches)) {
if (preg_match('~^(-?_?)' . preg_quote($this->extraprefix, '~') . '(.*)$~', $field, $matches)) {
return $matches[1] . $matches[2];
} else {
return null;