Sanitize custom permalink settings #5893
Labels
effort: [XS]
< 1 day of estimated development time
module: filesystem
priority: medium
Issues which are important, but no one will go out of business.
severity: critical
Defect that prevents the testing/use of the software
type: bug
Indicates an unexpected problem or unintended behavior
Milestone
Before submitting an issue please check that you’ve completed the following steps:
Describe the bug
Since version 3.13 we are using the permalink structure in
$rocket_permalink_structure
If the customer is using a custom structure with a weird input, it can cause a fatal error, because we don't sanitize this.
Example of an input that causes problems:
/'/%year%/%monthnum%/%day%/%postname%/'
https://i.imgur.com/2rZIyea.png
To Reproduce
Steps to reproduce the behavior:
/'/%year%/%monthnum%/%day%/%postname%/'
$rocket_permalink_structure = '/'/%year%/%monthnum%/%day%/%postname%/'';
Parse error: syntax error, unexpected token "%" in /wp-content/wp-rocket-config/yourdomain.php on line 82
Expected behavior
If WordPress accepts a permalink structure, we should be able to as well. We should sanitize this so it doesn't cause an error, even if it's an edge case.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Ticket: https://secure.helpscout.net/conversation/2207611833/412789?folderId=377611
Slack:https://wp-media.slack.com/archives/C43T1AYMQ/p1682465607573189
Backlog Grooming (for WP Media dev team use only)
The text was updated successfully, but these errors were encountered: