Skip to content
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

Replace deprecated FILTER_SANITIZE_STRING #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

otacke
Copy link
Contributor

@otacke otacke commented Apr 29, 2022

FILTER_SANITIZE_STRING is deprecated since PHP 8.0

@stronk7
Copy link

stronk7 commented Nov 15, 2022

Just came to this PR from elsewhere...

guessing if the replacement proposed here is enough, or we also have to apply for strip_tags(), as far as the, now deprecated in php 8.1, FILTER_SANITIZE_STRING also performed such stripping.

So, basically, in order to get 99% the same results than before, any of this should be ok, I think they are the same:

  • filter_var(strip_tags($input), FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_FLAG_NO_ENCODE_QUOTES))
  • htmlspecialchars(strip_tags($input), ENT_NOQUOTES))

Link: https://3v4l.org/7rphp (to see the behaviour both without and with FILTER_FLAG_NO_ENCODE_QUOTES)

Not sure how that tags stripping is important or no, just sharing that the original was performing it.

Ciao :-)

@andrewnicols
Copy link

Just checking if there are any updates on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants