symfony / webpack-encore-bundle

Symfony integration with Webpack Encore!
https://symfony.com/webpack-encore
MIT License
933 stars 83 forks source link

Fix double escaping in stimulus DTOs when using toArray() in combination with form methods #202

Closed jeroennoten closed 1 year ago

jeroennoten commented 1 year ago

This fixes a double-escaping bug when the toArray() methods are used in combination with the form_ functions, as described in the README.

toArray() should return an array with non-escaped attribute key-value pairs, because they will be escaped when printed.

Therefore, I moved the escaping of the values to the toString() methods and I added some additional tests for the DTO classes to verify the change.

This additionally fixes a missed escape for the data-[controller]-[key]-class attribute values.

weaverryan commented 1 year ago

Excellent PR Jeroen!