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

Error when website- or section-name includes an ampersand (2.x) #42

Closed
twiro opened this issue Aug 10, 2018 · 3 comments
Closed

Error when website- or section-name includes an ampersand (2.x) #42

twiro opened this issue Aug 10, 2018 · 3 comments
Labels

Comments

@twiro
Copy link
Member

twiro commented Aug 10, 2018

Summary:

Saving an entry will throw an XML-error if the section contains an instance of reflection field 2.x and either the website-name or the section-name contain an ampersand.

Detailed description:

I just updated the reflection field of a project from version 1.4.2 to the current version 2.0.4 and noticed that I got the following error whenever I tried to save an entry of a section that included the reflection field:

bildschirmfoto 2018-08-10 um 10 51 12

Did a little research and stumbled upon this discussion in the symphony forum that put me on the right track to hav a look at ampersands in my project.

Actually the website-name itself included an ampersand that seemed to cause the problem – I removed it and everything worked as expected. Later I ran into the same bug again, and noticed that the section-name (not the handle!) of the affected section also included an ampersand. Removed that too and everything worked again.

I also did another test and included an ampersand in a field-label, but that doesn't seem to cause any problems.

Conclusion

I haven't run into ampersand-based bugs in Symphony for a long time and as far as I can judge Symphony itself gets along with ampersands pretty good by now. As everything worked as expected before I updated reflection field to version 2.x this bug must have somehow been introduced with the 2.x-refactoring of the getXPath-function.

This XML in PHP stuff is a little over my head, so I think I won't be able to fox this myself… @nilshoerrmann or @nitriques – any ideas how to fix this?

@twiro twiro added the bug label Aug 10, 2018
@nilshoerrmann
Copy link
Contributor

This XML in PHP stuff is a little over my head, so I think I won't be able to fox this myself…

Same here :(

@nitriques
Copy link
Member

Top of my head, without any tests, I would try to add some General::sanitize() calls.

here, 2 times: https://github.com/symphonists/reflectionfield/blob/master/extension.driver.php#L157
for both name and value.

here https://github.com/symphonists/reflectionfield/blob/master/extension.driver.php#L171 for the section name

If not, the problem lies in a field's appendFormattedElement() implementation, which is called here https://github.com/symphonists/reflectionfield/blob/master/extension.driver.php#L203

XML and & do not like each other.

See symphonycms/symphonycms#2770 for a drastic fix.

@twiro twiro mentioned this issue Jul 7, 2021
@twiro
Copy link
Member Author

twiro commented Jul 7, 2021

Fixed in the latest release (2.0.5)

@twiro twiro closed this as completed Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants