[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] UserRegistration: Improve error handling for merged preferences

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68c223db9b8ed_2cddf2c2243a@gitlab-sidekiq-low-urgency-cpu-bound-v2-856dd689b5-wvmjc.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
61296b50 by Yves Ngalamulume at 2025-09-11T01:12:34+00:00
[FIX] UserRegistration: Improve error handling for merged preferences
---
* [FIX] UserRegistration: Improve error handling for merged preferences

* [FIX] Feedback validation to ensure 'mes' key is always an array

* [FIX] Remove the file that is not part of the MR

* [FIX] Remove the file that is not part of the MR

See merge request tikiwiki/tiki!8394

- - - - -


1 changed file:

- lib/smarty_tiki/FunctionHandler/UserRegistration.php


Changes:

=====================================
lib/smarty_tiki/FunctionHandler/UserRegistration.php
=====================================
@@ -33,14 +33,18 @@ class UserRegistration extends Base
             return;
         }
 
+        // Check if merged_prefs is an error object before using it as an array
+        if (is_a($registrationlib->merged_prefs, RegistrationError::class)) {
+            Feedback::error(['mes' => $registrationlib->merged_prefs->msg]);
+            return;
+        }
+
         $_VALID = tra("Please enter a valid %s.  No spaces, more than %d characters and contain %s");
         $smarty->assign('_PROMPT_UNAME', sprintf($_VALID, tra("username"), $registrationlib->merged_prefs['min_username_length'], "0-9,a-z,A-Z"));
         $smarty->assign('_PROMPT_PASS', sprintf($_VALID, tra("password"), $registrationlib->merged_prefs['min_pass_length'], "0-9,a-z,A-Z"));
         $smarty->assign('min_username_length', $registrationlib->merged_prefs['min_username_length']);
         $smarty->assign('min_pass_length', $registrationlib->merged_prefs['min_pass_length']);
-        if (is_a($registrationlib->merged_prefs, RegistrationError::class)) {
-            Feedback::error(['mes' => $registrationlib->merged_prefs->msg]);
-        }
+
         $smarty->assign_by_ref('merged_prefs', $registrationlib->merged_prefs);
         $smarty->assign('allowRegister', 'y');
 



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/61296b501d48153313863ae570e919ceb19b3eb9

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/61296b501d48153313863ae570e919ceb19b3eb9
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.