presslabs / gitium

Keep all your WordPress code on git with a simple plugin and a repo
https://www.presslabs.com/code/gitium/
GNU General Public License v2.0
180 stars 31 forks source link

The flag FILTER_SANITIZE_STRING is deprecated in PHP 8.1.0 #192

Closed domeales-paloit closed 1 week ago

domeales-paloit commented 1 year ago

Hi there,

We love Gitium, nice one!

We have just noticed after upgrading PHP that the flag FILTER_SANITIZE_STRING is deprecated in PHP 8.1.0.

I would like to submit a PR to replace the use of FILTER_SANITIZE_STRING with FILTER_SANITIZE_FULL_SPECIAL_CHARS. Based on the PHP docs for FILTER_SANITIZE_STRING it says:

Deprecated as of PHP 8.1.0, use htmlspecialchars() instead.

and for FILTER_SANITIZE_FULL_SPECIAL_CHARS it also says:

Equivalent to calling htmlspecialchars() with ENT_QUOTES set.

Therefore, it looks like FILTER_SANITIZE_FULL_SPECIAL_CHARS is a suitable replacement for FILTER_SANITIZE_STRING.

To note also, the constant FILTER_SANITIZE_FULL_SPECIAL_CHARS is available in PHP versions >= 5.3.3.

Would you be happy to receive this PR?