No Code Attached Yet
avatar ProjectItchyToes
ProjectItchyToes
16 Feb 2022

Steps to reproduce the issue

Use OutputFilter::stringUrlSafe

Expected result

Get an safe string returned

Actual result

Error Message:
Attempted to load class "Transliterate" from namespace "Joomla\Language".\n
Did you forget a "use" statement for another namespace?
"""
#code: 0
#file: "/srv/www//libraries/vendor/joomla/filter/src/OutputFilter.php"
#line: 130

System information (as much as possible)

Joomla 4.1.0

Additional comments

Change from
130: $str = StringHelper::strtolower((new Transliterate)->utf8_latin_to_ascii($string));
to
130: $str = StringHelper::strtolower((new \Joomla\CMS\Language\Transliterate())->utf8_latin_to_ascii($string));

or include it in the "use" statements

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar ProjectItchyToes ProjectItchyToes - open - 16 Feb 2022
avatar ProjectItchyToes ProjectItchyToes - change - 16 Feb 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 16 Feb 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 16 Feb 2022
avatar ProjectItchyToes ProjectItchyToes - change - 16 Feb 2022
The description was changed
avatar ProjectItchyToes ProjectItchyToes - edited - 16 Feb 2022
avatar drmenzelit
drmenzelit - comment - 18 Feb 2022

Where are you using the function?
Maybe you forgot to add
use \Joomla\CMS\Language\
in your code?

avatar ProjectItchyToes
ProjectItchyToes - comment - 21 Feb 2022

I am using this in an external cronjob. To include Language there would be a solution but in my opinion the class itself should "require" all needed resources.
And in all naivety, how can I possible know that OutputFilter does need Language.

avatar joomdonation joomdonation - change - 13 Nov 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-11-13 10:11:56
Closed_By joomdonation
avatar joomdonation joomdonation - close - 13 Nov 2022
avatar joomdonation
joomdonation - comment - 13 Nov 2022

Sorry for lately response. The solution is using OutputFilter from CMS package instead of from framework package (The OutputFilter from Joomla framework has optional dependency from Language package but it is not required in our CMS). In short, use something like:

use Joomla\CMS\Filter\OutputFilter;
OutputFilter::stringURLSafe($tring);

I'm closing this issue for now.

Add a Comment

Login with GitHub to post a comment