-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Short description of the issue
Titles that contain the exact string <=
are cut off in the page tree. This is caused by strip_tags in the method that renders the page title.
As an example, take the following page title:
Mini-Jobber (gross <= 450 €/month)
Expected behavior
The title should be displayed completely in the page tree:
Mini-Jobber (gross <= 450 €/month)
Actual behavior
The title gets cut off, because strip_tags removes anything after <=
:
Mini-Jobber (gross
Screenshots/Links that demonstrate the issue
With a space between the characters it works fine:
Without the space, the title gets cut off:
Suggestion for a possible fix
The issue is caused by this line in the source code. The titles get processed by both strip_tags and htmlspecialchars. Simply switching the order of those two functions would solve the problem:
php > $str = 'Mini-Jobber (gross <= 450 €/month)';
php > var_dump(htmlspecialchars(strip_tags($str), ENT_QUOTES, "UTF-8", false));
string(19) "Mini-Jobber (gross "
php > var_dump(strip_tags(htmlspecialchars($str, ENT_QUOTES, "UTF-8", false)));
string(39) "Mini-Jobber (gross <= 450 €/month)"
Another possibility would be to drop strip_tags entirely, from a security standpoint it's not really required if you use htmlspecialchars anyway.
Steps to reproduce the issue
- On a standard ProcessWire installation, create a page with the exact characters
<=
somewhere inside it's title. - The title in the page tree gets cut off at this point.
Setup/Environment
- ProcessWire: 3.0.149
- PHP: 7.4.3
- Webserver: Apache
- MySQL: 10.1.44-MariaDB-0ubuntu0.18.04.1