[TikiWiki-commits] [Git][tikiwiki/tiki][27.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 <6940f20d18554_2a17faac82744@gitlab-sidekiq-low-urgency-cpu-bound-v2-5d64c6946b-7crfv.mail>

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


Commits:
c981b4c6 by Victor Emanouilov at 2025-12-16T07:45:43+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
=====================================
@@ -859,12 +859,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;
     }
 
     /**
@@ -876,12 +878,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/c981b4c66337ef2208a5f88393039ffb61b6d0f0

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