[TikiWiki-commits] [Git][tikiwiki/tiki][master] [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 | <6940f1e54ee7d_2a17f980215f5@gitlab-sidekiq-low-urgency-cpu-bound-v2-5d64c6946b-29c7f.mail> |
Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
83e3491a by Victor Emanouilov at 2025-12-16T07:45:03+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/83e3491a848e0572bc8ef783f5e10f6fd22d5255
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/83e3491a848e0572bc8ef783f5e10f6fd22d5255
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