Closed
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
The issue has been fixed in 2.4-develop branchGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentThe issue has been reproduced on latest 2.3 release