[TikiWiki-commits] [Git][tikiwiki/tiki][24.x] [FIX] Implement 'raw' filter in TikiFilter class to avoid the error 'Filter not found: raw'
"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a8d83cac12f8_3839e146883037@gitlab-sidekiq-low-urgency-cpu-bound-v2-7f4b5767d6-qtsn7.mail> |
ushindi bienvenu pushed to branch 24.x at Tiki Wiki CMS Groupware / Tiki
Commits:
09618502 by Ushindi Gedeon at 2026-08-25T13:59:42+02:00
[FIX] Implement 'raw' filter in TikiFilter class to avoid the error 'Filter not found: raw'
---
See merge request tikiwiki/tiki!4768
- - - - -
2 changed files:
- lib/core/TikiFilter.php
- + lib/core/TikiFilter/Raw.php
Changes:
=====================================
lib/core/TikiFilter.php
=====================================
@@ -29,7 +29,7 @@ class TikiFilter
* Provides an object implementing Laminas\Filter\FilterInterface based on the input
*
* @param FilterInterface|string $filter A filter shortcut name, or the filter itself.
- * @return TikiFilter_Alnum|TikiFilter_Alpha|TikiFilter_AttributeType|TikiFilter_HtmlPurifier|TikiFilter_IsoDate|TikiFilter_Lang|TikiFilter_None|TikiFilter_PregFilter|TikiFilter_PreventXss|TikiFilter_RawUnsafe|TikiFilter_RelativeURL|TikiFilter_WikiContent|Boolean|Digits|FilterInterface|PregReplace|StripTags|ToInt
+ * @return TikiFilter_Alnum|TikiFilter_Alpha|TikiFilter_AttributeType|TikiFilter_HtmlPurifier|TikiFilter_IsoDate|TikiFilter_Lang|TikiFilter_None|TikiFilter_PregFilter|TikiFilter_PreventXss|TikiFilter_RawUnsafe|TikiFilter_Raw|TikiFilter_RelativeURL|TikiFilter_WikiContent|Boolean|Digits|FilterInterface|PregReplace|StripTags|ToInt|TikiFilter_Array
*
* @link https://dev.tiki.org/Filtering+Best+Practices
* @link https://zendframework.github.io/zend-filter/
@@ -201,6 +201,10 @@ class TikiFilter
// Test Return " :/g.,:|4h&#Δ δ_🍘コン onclick<b><script> "
// Exotic filter which will remove the '<x>', for values previously "neutered" by the PreventXss filter
return new TikiFilter_RawUnsafe();
+ case 'raw':
+ // Test Return " :/g.,:|4h&#Δ δ_🍘コン onclick<b><script> "
+ // Raw data, no filtering
+ return new TikiFilter_Raw();
default:
trigger_error('Filter not found: ' . $filter, E_USER_WARNING);
=====================================
lib/core/TikiFilter/Raw.php
=====================================
@@ -0,0 +1,20 @@
+<?php
+
+// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
+//
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+// FIXME: This may quietly alter the value. Users of this filter should report if the value is modified.
+class TikiFilter_Raw implements Laminas\Filter\FilterInterface
+{
+ /**
+ * Returns the input value unchanged
+ *
+ * @param mixed $value
+ * @return mixed
+ */
+ public function filter($value)
+ {
+ return $value;
+ }
+}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/09618502ae65c0c5dea87e351467582569c20a3f
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/09618502ae65c0c5dea87e351467582569c20a3f
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs