[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] CommentController: prevent trim() deprecation by handling null input values

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69691f17dc8b5_2c181e4c410f5@gitlab-sidekiq-low-urgency-cpu-bound-v2-f5cc6c9bf-p29rh.mail>

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


Commits:
3110e0e9 by David Maene at 2026-01-15T16:59:49+00:00
[FIX] CommentController: prevent trim() deprecation by handling null input values
---
* [FIX] CommentController: prevent trim() deprecation by handling null input values

See merge request tikiwiki/tiki!9106

- - - - -


1 changed file:

- lib/core/Services/Comment/Controller.php


Changes:

=====================================
lib/core/Services/Comment/Controller.php
=====================================
@@ -133,12 +133,19 @@ class Services_Comment_Controller
         }
 
         $errors = [];
-
-        $title = trim($input->title->xss());
+        $titleRaw = $input->title->xss();
         $data = trim($input->data->wikicontent());
 
+        if ($prefs['comments_notitle'] == 'y') {
+            $title = 'Untitled';
+        } else {
+            // If title is not set, use an empty string
+            $title = $titleRaw !== null ? $titleRaw : "";
+        }
+
         $tikilib = TikiLib::lib('tiki');
         $data = $tikilib->convertAbsoluteLinksToRelative($data);
+        $title = trim($title);
 
         $watch = $input->watch->text();
         $contributions = [];
@@ -186,11 +193,6 @@ class Services_Comment_Controller
                 }
             }
 
-            if ($prefs['comments_notitle'] == 'y') {
-                $title = 'Untitled';
-            }
-
-
             if (count($errors) === 0) {
                 $message_id = ''; // By ref
                 $threadId = $commentslib->post_new_comment(



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

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