-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP8.2 compatibility #775
PHP8.2 compatibility #775
Conversation
@Progi1984 |
@ophian I fixed it and rebase the PR. |
Please have a look at the unit tests? There are still failures. |
@wisskid I just fixed tests. Thanks |
Hi @wisskid, have you some time to restart the CI, please ? |
CI is running. Can you explain the changes to the escape modifier compiler? It seems different in the way the methods are nested. |
@wisskid The CI is fixed. I checked PHPUnit on PHP 8.2 RC / PHP 8.1 / PHP 8.0 / PHP 7.4 / PHP 7.3 / PHP 7.2 : https://github.com/Progi1984/smarty/actions/runs/3060762059 The encoding HTML-ENTITIES has been deprecated since PHP 8.2 : https://php.watch/versions/8.2/mbstring-qprint-base64-uuencode-html-entities-deprecated#html and tried to use the suggested replacement by php.watch. In this way, unit tests are not broken (Thanks to them 🙏) |
Hi @Progi1984 Could you elaborate why this change was necessary? Was there an error you had? BTW. |
@ophian Of course, in PHP 8.2, I check the change ( CI is 🟢 : https://github.com/Progi1984/smarty/actions/runs/3080652601 |
Hi @wisskid, have you some time to restart the CI, please ? |
Thanks for the CI @wisskid : it's 🟢 |
Hi @wisskid, have you some time to review this PR, please ? Thanks for your time. |
@Progi1984 this looks great! I'll double check the encoding/escaping change and merge asap. |
} else { | ||
// fall back to modifier.escape.php | ||
} | ||
return 'htmlspecialchars_decode(mb_convert_encoding(htmlentities(htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Progi1984 I still fail to see what is happening here. The unit tests are passing, but this nesting doesn't feel right. The php.watch site says "Although not recommended, if the '"<>& must not be encoded, this behavior can be achieved with an htmlspecialchars_decode call". This doesn't apply here. Should we just use htmlentities
like on line 52?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
} else { | ||
// fall back to modifier.escape.php | ||
} | ||
return 'htmlspecialchars_decode(mb_convert_encoding(htmlentities(htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
…erplugin and modifiercompiler.
🎉 @wisskid (and thanks for discussions) |
* PHP8.2 compatibility * PHP8.2 compatibility : Fixed unit tests * PHP8.2 compatibility : Replace ENT_COMPAT by ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 * PHP8.2 compatibility : Remove deprecated utf8_decode * PHP8.2 compatibility : Remove HTML-ENTITIES parameter * Removed some unused code for clarity, updated the changelog. * More concise escape implementation and unit test to cover both modifierplugin and modifiercompiler. * Fix htmlall unescape of quotes without mbstring too Co-authored-by: Simon Wisselink <[email protected]>
Added suport for PHP8.2 compatibility.
Thanks @ophian