I want to override JFilterInput class on Joomla. The file is on below path:


Because this file developed just for non-Unicode characters.So it shows

Notice: Array to string conversion

on line 233 in many components like com_finder that uses this class for Unicode characters. That line is:

$result = (string) preg_replace('/[^A-Z0-9_\.-]/i', '', $source);

for this reason I wanted to override this line and same others. firstly I developed a Joomla system plugin to override this file with onAfterRoute() method but by following this post in stackexchange I changed onAfterRoute() method to onAfterInitialise() method. But again it shows below fatal error:

Fatal error: Cannot redeclare class JFilterInput

Now I'm looking forward to get helps from everybody which solve this problem. in addition, I use last version of Joomla

  • onAfterInitialise is the event used once the framework has dispatched the application. Meaning JFilterInput already exists, which is why you're getting the error Cannot redeclare class JFilterInput. Rather than trying to redefine the class, try extending it
    – Lodder
    Jul 16, 2015 at 11:12
  • I understood very helpful tip from your comment. Just could you help a little more; how can I extend this class plz. A link or any sample code with regards
    – Sam
    Jul 16, 2015 at 12:49
  • 1
    A demo plugin written by @Don Gilbert can be found here: gist.github.com/dongilbert/3237387
    – Lodder
    Jul 16, 2015 at 13:25

1 Answer 1


It is strange that it return "Notice: Array to string conversion". It usually means that you try to get array variable using string functions. Check what data do you push directly in $_REQUEST.

Back to question. You can always use RAW type of filter if filtering is to strict.

If you still need to override this class please check this plugin sample: https://gist.github.com/dongilbert/3237387.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.