MDL-44657 forms: Form identifiers should only contain basic characters
authorPaul Holden <pholden@greenhead.ac.uk>
Thu, 13 Nov 2014 08:20:16 +0000 (16:20 +0800)
committerFrederic Massart <fred@moodle.com>
Thu, 13 Nov 2014 08:20:28 +0000 (16:20 +0800)
lib/formslib.php

index acb5db3..1291d31 100644 (file)
@@ -211,7 +211,9 @@ abstract class moodleform {
      * @return string form identifier.
      */
     protected function get_form_identifier() {
-        return get_class($this);
+        $class = get_class($this);
+
+        return preg_replace('/[^a-z0-9_]/i', '_', $class);
     }
 
     /**