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

"Espoir Baraka \(@esbarakabigega\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a01e2ca49939_38190f284202f@gitlab-sidekiq-low-urgency-cpu-bound-v2-75b6448d59-sw697.mail>

Espoir Baraka pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
d3957565 by Espoir Baraka at 2026-05-11T15:40:58+02:00
[FIX] Tiki-register: Fix TypeError in tracker plugin when action parameter is a string
---
* [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

(cherry picked from commit a21fe5c1e0782e51fbebb478f4bb51c6ba6d81e4)

See merge request tikiwiki/tiki!10185

- - - - -


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/d3957565b5219139fcf6ca53b62017fed4c43ae3

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d3957565b5219139fcf6ca53b62017fed4c43ae3
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.