[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Tiki-register: Fix TypeError in tracker plugin when action parameter is a string

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69e27c93b7476_3b18e00c4266f@gitlab-sidekiq-low-urgency-cpu-bound-v2-8d9bdf45f-5fc45.mail>

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


Commits:
a21fe5c1 by Espoir Baraka at 2026-04-17T18:23:49+00:00
[FIX] Tiki-register: Fix TypeError in tracker plugin when action parameter is a string
---
* [REF] Make separator processing a plugin concern

* [ENH] Remove redundant separator processing from Plugin Tracker and delegate it to ParserLib

* [REF] ParserLib: Use centralized separator handling

* [ENH] Add separator processing to plugin parameters and clean up user registration field handling

* [FIX] Tiki-register: Fix TypeError in tracker plugin when action parameter is a string

See merge request tikiwiki/tiki!9822

- - - - -


3 changed files:

- lib/core/WikiPlugin/Helper.php
- lib/smarty_tiki/FunctionHandler/UserRegistration.php
- lib/wiki-plugins/wikiplugin_tracker.php


Changes:

=====================================
lib/core/WikiPlugin/Helper.php
=====================================
@@ -118,4 +118,44 @@ class WikiPlugin_Helper
 
         return $missing;
     }
+
+    /**
+     * Apply separator processing to plugin parameters
+     *
+     * Converts string parameters with defined separators into arrays. (eg. "1:2:3" converts to [1, 2, 3])
+     *
+     * @param array $params Plugin parameters
+     * @param array $info Plugin info array (must contain 'params')
+     * @return array Updated parameters with separators applied
+     */
+    public static function applySeparators($params, $info)
+    {
+        $tikilib = TikiLib::lib('tiki');
+
+        if (! isset($info['params'])) {
+            return $params;
+        }
+
+        foreach ($info['params'] as $key => $paramInfo) {
+            if (! isset($paramInfo['separator'])) {
+                continue;
+            }
+
+            // Skip if parameter not provided or is null
+            if (! isset($params[$key]) || $params[$key] === null) {
+                continue;
+            }
+
+            // If already an array, skip processing
+            if (is_array($params[$key])) {
+                continue;
+            }
+
+            // Split the string value using the separator
+            $params[$key] = $tikilib->multi_explode($paramInfo['separator'], $params[$key]);
+            $params[$key] = array_values(array_filter($params[$key]));
+        }
+
+        return $params;
+    }
 }


=====================================
lib/smarty_tiki/FunctionHandler/UserRegistration.php
=====================================
@@ -158,9 +158,6 @@ class UserRegistration extends Base
                     $user = $_REQUEST['name'];  // so that one can set user preferences at registration time
                     $_REQUEST['iTRACKER'] = 1;  // only one tracker plugin on registration
                 }
-                if (! is_array($re['registrationUsersFieldIds'])) {
-                    $re['registrationUsersFieldIds'] = explode(':', $re['registrationUsersFieldIds']);
-                }
                 if ($registrationlib->merged_prefs["user_register_prettytracker"] == 'y' && ! empty($registrationlib->merged_prefs["user_register_prettytracker_tpl"])) {
                     if (str_ends_with($registrationlib->merged_prefs["user_register_prettytracker_tpl"], ".tpl")) {
                         $userTrackerData = TikiLib::lib('parser')->invokePlugin(


=====================================
lib/wiki-plugins/wikiplugin_tracker.php
=====================================
@@ -712,6 +712,7 @@ function wikiplugin_tracker($data, $params)
     $smarty->assign('trackerEditFormId', $iTRACKER);
     $item = [];
 
+    $params = WikiPlugin_Helper::applySeparators($params, wikiplugin_tracker_info());
     extract($params, EXTR_SKIP);
 
     $thisIsThePlugin = isset($_REQUEST['iTRACKER']) && $_REQUEST['iTRACKER'] == $iTRACKER;



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

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a21fe5c1e0782e51fbebb478f4bb51c6ba6d81e4
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
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.