Permalink
Browse files

MDL-15897: Changed admin_setting_configtext.validate() check to not t…

…reat all strings as custom regex's (since PARAM_* constants are now strings).

Instead require them to have '/' at the beginning and end of the pattern.

The only setting that appears to use a custom regex is scorm/apidebugmask - now updated to contain surrounding slashes.
  • Loading branch information...
ashleyholman
ashleyholman committed Sep 18, 2009
1 parent fd4faf9 commit 58aaa8e97e2ace2c8c804a069b109a8e2319ef30
Showing with 4 additions and 3 deletions.
  1. +2 −1 lib/adminlib.php
  2. +2 −2 mod/scorm/settings.php
View
@@ -1508,7 +1508,8 @@ public function write_setting($data) {
* @return mixed true if ok string if error found
*/
public function validate($data) {
- if (is_string($this->paramtype)) {
+ // allow paramtype to be a custom regex if it is the form of /pattern/
+ if (preg_match('#^/.*/$#', $this->paramtype)) {
if (preg_match($this->paramtype, $data)) {
return true;
} else {
View
@@ -56,6 +56,6 @@
$settings->add(new admin_setting_configcheckbox('scorm/allowapidebug', get_string('allowapidebug', 'scorm'), '', 0));
-$settings->add(new admin_setting_configtext('scorm/apidebugmask', get_string('apidebugmask', 'scorm'), '', '.*'));
+$settings->add(new admin_setting_configtext('scorm/apidebugmask', get_string('apidebugmask', 'scorm'), '', '/.*/'));
-?>
+?>

0 comments on commit 58aaa8e

Please sign in to comment.