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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user