[TikiWiki-commits] [Git][tikiwiki/tiki][master] 5 commits: [FIX] Fix phpunit test warning introduced in !8090

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69ebde9b8c781_38198c1455085@gitlab-sidekiq-low-urgency-cpu-bound-v2-56b5c5d6d9-6hlsl.mail>

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


Commits:
a471b8b5 by Benoit Grégoire at 2026-04-24T15:48:13-04:00
[FIX] Fix phpunit test warning introduced in !8090

- - - - -
b0eb6fe0 by Benoit Grégoire at 2026-04-24T15:55:52-04:00
[FIX] modlib.php:  Fix intermittent Warning: Undefined array key "cookie_consent_feature" in unit test caused by unitialized preferences

- - - - -
6d7992cd by Benoit Grégoire at 2026-04-24T16:17:42-04:00
[FIX] phpunit:  Clear warning Undefined array key HTTP_REFERER in lib/core/Services/Wiki/Controller.php when running unit tests

- - - - -
3f04e110 by Benoit Grégoire at 2026-04-24T16:33:01-04:00
[FIX] lib/core/Services/Wiki/Controller.php incorrectly called asArray as a filter

- - - - -
fda51067 by Benoit Grégoire at 2026-04-24T16:51:44-04:00
[FIX] lib/core/Feedback.php:  Stop trying to send headers in command line.  This silences phpunit warnings, although it's likely developpers tried to use the Feedback class in code that isn't meant to always run in a web context.

- - - - -


4 changed files:

- lib/core/Feedback.php
- lib/core/Services/Comment/Controller.php
- lib/core/Services/Wiki/Controller.php
- lib/modules/modlib.php


Changes:

=====================================
lib/core/Feedback.php
=====================================
@@ -302,14 +302,16 @@ class Feedback
      *
      * @throws Exception
      */
-    public static function sendHeaders()
+    public static function sendHeaders(): void
     {
-        require_once 'lib/smarty_tiki/function.feedback.php';
-        $feedback = rawurlencode(str_replace(["\n", "\r", "\t"], '', smarty_function_feedback(
-            [], // Encode since HTTP headers are ASCII-only. Other characters can go through, but header()'s documentation has no word on their treatment. Chealer 2017-06-20
-            TikiLib::lib('smarty')->getEmptyInternalTemplate()
-        )));
-        header('X-Tiki-Feedback: ' . $feedback);
+        if (PHP_SAPI !== 'cli') {
+            require_once 'lib/smarty_tiki/function.feedback.php';
+            $feedback = rawurlencode(str_replace(["\n", "\r", "\t"], '', smarty_function_feedback(
+                [], // Encode since HTTP headers are ASCII-only. Other characters can go through, but header()'s documentation has no word on their treatment. Chealer 2017-06-20
+                TikiLib::lib('smarty')->getEmptyInternalTemplate()
+            )));
+            header('X-Tiki-Feedback: ' . $feedback);
+        }
     }
 
     /**


=====================================
lib/core/Services/Comment/Controller.php
=====================================
@@ -218,7 +218,7 @@ class Services_Comment_Controller
                     $version
                 );
                 if ($threadId) {
-                    $related_files = $input->related_files->raw();
+                    $related_files = $input->related_files->raw() ?? [];
                     foreach ($related_files as $fileId) {
                         TikiLib::lib('relation')->add_relation('tiki.comment.recording', 'comment', $threadId, 'file', $fileId, false);
                     }


=====================================
lib/core/Services/Wiki/Controller.php
=====================================
@@ -59,7 +59,7 @@ class Services_Wiki_Controller
             false,
             true,
             $input->onlyOrphans->text() == 'y',
-            $input->filter->asArray(),
+            $input->asArray(),
             $input->onlyCount->text() == 'y'
         );
     }
@@ -536,7 +536,7 @@ class Services_Wiki_Controller
             //return to page
             if (
                 count($util->items) === 1 && ($all || $util->extra['one'])
-                && strpos($_SERVER['HTTP_REFERER'], $allinfo['pageName']) !== false
+                && strpos($_SERVER['HTTP_REFERER'] ?? '', $allinfo['pageName']) !== false
             ) {
                 //go to tiki index if the page the user was on has been deleted - avoids no page found error.
                 global $prefs, $base_url;


=====================================
lib/modules/modlib.php
=====================================
@@ -1060,7 +1060,7 @@ class ModLib extends TikiLib
             ]
         );
 
-        if ($prefs['cookie_consent_feature'] === 'y' && $prefs['cookie_consent_disable'] !== 'y') {
+        if (($prefs['cookie_consent_feature'] ?? null) === 'y' && $prefs['cookie_consent_disable'] !== 'y') {
             $info['params']['cookie_consent'] = [
                 'name' => tra('Cookie Consent'),
                 'description' => 'n|y ' . tra('Show only if consent to accept cookies has been granted.'),



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/compare/b5488d008d4c70d45927b74ebb8213762688870c...fda510671868d720dc8805b4231d1a7080a46aa0

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