[TikiWiki-commits] [Git][tikiwiki/tiki][28.x] [FIX] smarty preg_match and preg_match_all return results as they can't be passed back by reference

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6940f205539_2a17f96c15462@gitlab-sidekiq-low-urgency-cpu-bound-v2-5d64c6946b-rjnkf.mail>

Victor Emanouilov pushed to branch 28.x at Tiki Wiki CMS Groupware / Tiki


Commits:
5b9b0cfb by Victor Emanouilov at 2025-12-16T07:45:36+02:00
[FIX] smarty preg_match and preg_match_all return results as they can't be passed back by reference

- - - - -


1 changed file:

- lib/smarty_tiki/Extension/SmartyTikiExtension.php


Changes:

=====================================
lib/smarty_tiki/Extension/SmartyTikiExtension.php
=====================================
@@ -862,12 +862,14 @@ class SmartyTikiExtension extends \Smarty\Extension\Base
     * @param array  $matches
     * @param int    $flags
     * @param int    $offset
-    * @return int|flase
+    * @return array matches
     * @see https://php.net/manual/en/function.preg-match.php for details about the params description
     */
     public function smartyModifierPregMatch($pattern, $subject, $matches = null, $flags = 0, $offset = 0)
     {
-        return preg_match($pattern, $subject, $matches, $flags, $offset);
+        // return matches here as Smarty doesn't support modifier or function arguments by reference
+        preg_match($pattern, $subject, $matches, $flags, $offset);
+        return $matches;
     }
 
     /**
@@ -879,12 +881,14 @@ class SmartyTikiExtension extends \Smarty\Extension\Base
     * @param array  $matches
     * @param int    $flags
     * @param int    $offset
-    * @return int|flase
+    * @return array matches
     * @see https://php.net/manual/en/function.preg-match.php for details about the params description
     */
     public function smartyModifierPregMatchAll($pattern, $subject, $matches = null, $flags = 0, $offset = 0)
     {
-        return preg_match_all($pattern, $subject, $matches, $flags, $offset);
+        // return matches here as Smarty doesn't support modifier or function arguments by reference
+        preg_match_all($pattern, $subject, $matches, $flags, $offset);
+        return $matches;
     }
 
     /**



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

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