[TikiWiki-commits] [Git][tikiwiki/tiki][29.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 | <6940f1ee68345_2a17f96c2893f@gitlab-sidekiq-low-urgency-cpu-bound-v2-5d64c6946b-nrptm.mail> |
Victor Emanouilov pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
02bb5613 by Victor Emanouilov at 2025-12-16T07:45:13+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
=====================================
@@ -851,12 +851,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;
}
/**
@@ -868,12 +870,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/02bb56139fe0b061852ca2a459b9a8b71511f91f
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/02bb56139fe0b061852ca2a459b9a8b71511f91f
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