When cloning a theme, we replace namespaces based on the theme name you enter.
However, in the current implementation, there have been many reported cases where incorrect code was generated as a result of the replacement. Theme names that can cause problems include symbols, non-Latin characters, emojis, numbers, etc.
The code generated from this theme name can cause critical errors by generating invalid function names, namespaces, variable names, etc. This issue does not only occur with PHP, but can occur with any file extension that is considered eligible for replacement.
Examples of reported issues:
In #503, two ideas are proposed to get around this issue:
- Validate the theme name and not allow them to start with digits
- Sanitize the theme name in a way that makes sure it's a valid PHP function prefix
The code and formatting that is considered invalid vary depending on the file extension. Let's explore what the best approach is.
When cloning a theme, we replace namespaces based on the theme name you enter.
However, in the current implementation, there have been many reported cases where incorrect code was generated as a result of the replacement. Theme names that can cause problems include symbols, non-Latin characters, emojis, numbers, etc.
The code generated from this theme name can cause critical errors by generating invalid function names, namespaces, variable names, etc. This issue does not only occur with PHP, but can occur with any file extension that is considered eligible for replacement.
Examples of reported issues:
In #503, two ideas are proposed to get around this issue:
The code and formatting that is considered invalid vary depending on the file extension. Let's explore what the best approach is.