[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] servicelib.php: Undefined array key "controller"

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69696e8b21476_2c181938895ad@gitlab-sidekiq-low-urgency-cpu-bound-v2-557bd5fd86-mw7cw.mail>

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


Commits:
5c672879 by Grace Nshokano at 2026-01-15T22:38:34+00:00
[FIX] servicelib.php: Undefined array key "controller"
---
* [FIX] Undefined array key 'controller' in getUrl() calls when sefurl enable

See merge request tikiwiki/tiki!8831

- - - - -


3 changed files:

- lib/core/Services/OAuthServer/Controller.php
- lib/core/Tracker/Field/UserSelector.php
- lib/servicelib.php


Changes:

=====================================
lib/core/Services/OAuthServer/Controller.php
=====================================
@@ -113,6 +113,8 @@ class Services_OAuthServer_Controller
 
         if (empty($user)) {
             unset($_SESSION['loginfrom']);
+            $params['controller'] = 'oauthserver';
+            $params['action'] = 'consent';
             $_SESSION['loginfrom'] = $servicelib->getUrl($params);
             $accesslib->redirect('tiki-login_scr.php');
             exit;


=====================================
lib/core/Tracker/Field/UserSelector.php
=====================================
@@ -354,10 +354,11 @@ class Tracker_Field_UserSelector extends \Tracker\Field\AbstractItemField implem
                         $selected_groups = array_unique(array_merge($selected_groups, $userlib->get_user_groups($v)));
                     }
                     TikiLib::setExternalContext(true);
-                    $templateData['remote_url'] = TikiLib::lib('service')->getUrl([
+                    $params = [
                         'groups' => implode(',', $selected_groups),
                         'listonly' => $this->trackerField->getOption('showRealname') ? 'userrealnames' : 'users',
-                    ]);
+                    ];
+                    $templateData['remote_url'] = TikiLib::lib('service')->getUrl('tiki-ajax_services.php?' . http_build_query($params));
                 } else {
                     $users = $userlib->get_members($groups);
                     foreach ($users as $group => &$usrs) {


=====================================
lib/servicelib.php
=====================================
@@ -53,16 +53,24 @@ class ServiceLib
 
         $url = '';
         if (isset($prefs['feature_sefurl']) && $prefs['feature_sefurl'] == 'y') {
-            $url = "tiki-{$params['controller']}";
-
-            if (isset($params['action'])) {
-                $url .= "-{$params['action']}";
+            if (! isset($params['controller'])) {
+                trigger_error(
+                    'getUrl() called with array missing "controller" key. Use string parameter for direct URLs. Parameters: ' . json_encode($params),
+                    E_USER_NOTICE
+                );
+                $url = 'tiki-ajax_services.php';
             } else {
-                $url .= "-x";
-            }
+                $url = "tiki-{$params['controller']}";
 
-            unset($params['controller']);
-            unset($params['action']);
+                if (isset($params['action'])) {
+                    $url .= "-{$params['action']}";
+                } else {
+                    $url .= "-x";
+                }
+
+                unset($params['controller']);
+                unset($params['action']);
+            }
         } else {
             $url = 'tiki-ajax_services.php';
         }



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

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