Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown format specifier "C" #228

Open
rustykowski opened this issue Jan 11, 2023 · 6 comments
Open

Unknown format specifier "C" #228

rustykowski opened this issue Jan 11, 2023 · 6 comments

Comments

@rustykowski
Copy link

Contao 4.9.37
contao-news_categories 3.4.20 or 3.4.23
PHP 8.0 or 8.1

I get a critical error, when trying to display a newslist or news-reader:

Uncaught PHP Exception ValueError: "Unknown format specifier "C"" at /xxx/vendor/codefog/contao-news_categories/src/NewsCategoriesManager.php line 52
@fritzmg
Copy link
Contributor

fritzmg commented Jan 11, 2023

Could it be that you have news, pages or categories with a % in their alias?

@rustykowski
Copy link
Author

there are several news-titles with german umlauts, such as /projekt/bildung-für-eine-starke-demokratie/ (/projekt/bildung-f%C3%BCr-eine-starke-demokratie/)

@fritzmg
Copy link
Contributor

fritzmg commented Jan 11, 2023

Yeah, that's the reason why sprintf will then fail.

@rustykowski
Copy link
Author

Thanks a lot, fritzmg!

@qzminski
Copy link
Member

Thank you @fritzmg for debugging this. It happens because of URL caching here: https://github.com/codefog/contao-news_categories/blob/master/src/NewsCategoriesManager.php#L44-L52

I will check if it still really needs the caching in Contao 4.13 and above.

@fritzmg
Copy link
Contributor

fritzmg commented Jan 11, 2023

I think in Contao 5 we moved away from generating URLs via sprintf placeholders for similar reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants