UTF8 routing not taken into account when saved as draft, then published.
simonnorris-publishit opened this issue · 5 comments
Q | A |
---|---|
Bug? | yes |
New Feature? | no |
SuluArticleBundle Version | 2.1.2 |
Sulu Version | 2.1.2 |
Actual Behavior
When creating an article with SuluArticleBundle, if I save as draft before publishing, the checking of the route is not not done, so accents are not converted and are therefore saved. When visiting the article on the front, I get the error, LogicException: "Cannot use UTF-8 route patterns without setting the "utf8" option
When I launch the command php bin/console debug:config framework
, I can see that I have utf8: true
set (which is set by default for Sulu).
In a webspace, it is not possible to add an accent to a Resourcelocator (it is not valid), but with article bundle, when saving the draft or publishing the article, I do not have this validation check, so I can save the Resourcelocator with the accents, but when I visit the front, it creates an internal server error.
Expected Behavior
Either accents are blocked for the Resourcelocator when saving / publishing or the utf8 option is accessible when viewing the page.
Steps to Reproduce
Add an accent to the Resourcelocator when creating an article with SuluArticleBundle, then save as draft, then publish.
Hey,
I just tried to reproduce this on the Sulu demo (https://sulu.rocks/). Unfortunately, I was not able to produce the error.
Could you provide the exact steps how to reproduce this?
Hey.
Once connected to the back-office, click on the menu item 'Articles' in the left-hand column.
Once the list of articles has loaded, click on the 'Add' button at the top of the page.
Fill in the form with an accent in the Resourcelocator.
Click on the 'Save as draft' button to save as a draft.
Once it has been saved as a draft, click on 'Publish' and the article is Published, but with the accents in the Resourcelocator.
I did a video to show the error if that helps : https://www.awesomescreenshot.com/video/1364695?key=6feec230231f2dc2f0b6181bb03f34c3
I was able to reproduce the problem by copying accééeeents
directly into the Resourcelocator
field.
I created a PR for the sulu/sulu
package to allow these character inside of routes (see sulu/sulu#5561). But I am not sure about the side effects of this change and therefore I am not sure if it will get merged.
Aside from the PR, what would be the expected/correct behaviour here? Creating the route with the UTF8 symbols? Or prevent saving like it is done for pages?
Thanks @nnatter
I have a little trouble understanding what is wanted to be achieved with the configuration option introduced in Symfony 3.2, but my guess is that accents should now be accepted in url's (because the internet isn't only in English I guess).
I think the important element for the behavior is that the back-office shouldn't allow things that throw errors on the front.
Whether its by 'Creating the route with the UTF8 symbols' or 'prevent saving like it is done for pages' I think will depend on individuals. Personally I don't mind either.
With sulu/sulu#5591, the next version of Sulu will not allow to enter special characters into the route field anymore. That should also prevent this issue, therefore I am going to close this