MDL-52017 enrol_self: fix incorrect empty statement
authorDan Poltawski <dan@moodle.com>
Tue, 22 Dec 2015 09:47:13 +0000 (09:47 +0000)
committerDan Poltawski <dan@moodle.com>
Tue, 22 Dec 2015 09:48:56 +0000 (09:48 +0000)
Ironically this was detected by causing a syntax error on php54

enrol/self/edit_form.php

index 6c65c6f..af10050 100644 (file)
@@ -181,7 +181,7 @@ class enrol_self_edit_form extends moodleform {
             $policy  = $plugin->get_config('usepasswordpolicy');
             if ($require and trim($data['password']) === '') {
                 $errors['password'] = get_string('required');
-            } else if (!empty($data['password'] && $policy)) {
+            } else if (!empty($data['password']) && $policy) {
                 $errmsg = '';
                 if (!check_password_policy($data['password'], $errmsg)) {
                     $errors['password'] = $errmsg;