-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: Framework/EscaperFixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releasegood first issue
Description
Preconditions
- Magento 2.3.3
Steps to reproduce
Case 1
- Register a new customer from frontend;
- Created one order from frontend;
- Add & to store view name
- Go to Admin >> Stores >> All Stores
- Click on "Default Store View"
- Change Name field to "Default & Store View"
- Click "Save Store View" button
- Remove all log files from magento2/var/log directory (in order to have only needed logs)
- Go to Frontend >> [user name] >> My Account >> My Orders;
- Click on "View Order" link for our order that was created in step 2;
- See magento2/var/log directory;
Expected result
- No exception logs should be there
Actual result
- exception.log file appeared with one line:
[[2019-12-03 10:47:42] main.CRITICAL: DOMDocument::loadHTML(): Tag date invalid in Entity, line: 1 {"exception":"[object] (InvalidArgumentException(code: 2): DOMDocument::loadHTML(): Tag date invalid in Entity, line: 1 at /home/arthur/sites/magento/magento233/vendor/magento/framework/Escaper.php:89)"} []
Case 2
- Register a new customer from frontend;
- Created one order from frontend;
- Go to Admin->Sales->Orders;
- Click on the "View" link for our order that was created in step 2;
- In "Order Total" block add comment "&";
- Click on the "Submit Comment" button;
- Remove all log files from magento2/var/log directory (in order to have only needed logs)
- Go to Frontend >> [user name] >> My Account >> My Orders;
- Click on "View Order" link for our order that was created in step 2;
- See magento2/var/log directory;
Expected result
- No exception logs should be there
Actual result
- exception.log file appeared with one line:
[[2019-12-03 10:55:22] main.CRITICAL: DOMDocument::loadHTML(): Tag date invalid in Entity, line: 1 {"exception":"[object] (InvalidArgumentException(code: 2): DOMDocument::loadHTML(): Tag date invalid in Entity, line: 1 at /home/arthur/sites/magento/magento233/vendor/magento/framework/Escaper.php:89)"} []
Reason: On View order page in the admin we have "Purchased From" block.
This block uses \Magento\Framework\Escaper::escapeHtml
with string that contains ampersand and allowed tags is "br". In this case it writes critical log. This issue appeared in Magento 2.2.0, it was introduced in 59c2c9e + df261e7 + 624ee86.
For someone who will fix this issue:
I prepared tests for this fix in my branch that are currently fails (not only this case):
2.2-develop...ihor-sviziev:escaper-critical-log-when-ampersand-is-present
Metadata
Metadata
Assignees
Labels
Component: Framework/EscaperFixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releasegood first issue