Wixel / GUMP

A fast, extensible & stand-alone PHP input validation class that allows you to validate any data
https://wixelhq.com
MIT License
1.17k stars 341 forks source link

PHP8 deprecated warning #329

Closed ponasromas closed 2 years ago

ponasromas commented 2 years ago

Here is unresolved warning for PHP 8.0/8.1.

PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated

/vendor/wixel/gump/gump.class.php on line 1047

I will not even bother to push fix for this as Wixel does not merge any changes for a long time. Quick fix: Change FILTER_SANITIZE_STRING to FILTER_UNSAFE_RAW.

hayusama commented 2 years ago

it is imperative to push this modification... it allows to have a fix for php 8+

filisko commented 2 years ago

We need migrate Travis CI to GitHub CI first in order to see how it affects previous versions of PHP

filisko commented 2 years ago

@ponasromas @hayusama using FILTER_UNSAFE_RAW is actually VERY bad idea.

Any other proposal?

ponasromas commented 2 years ago

No. PHP declares that FILTER_SANITIZE_STRING == FILTER_UNSAFE_RAW . So both solutions are not the best.

filisko commented 2 years ago

They're not the same. FILTER_UNSAFE_RAW doesn't do anything.

You can check the following test:

https://github.com/Wixel/GUMP/blob/master/tests/Filters/SanitizeStringFilterTest.php

ponasromas commented 2 years ago

And what sanitize_string do? Please read php docs on that matter and why sanitize_string can be replaced by ...raw.

filisko commented 2 years ago

The test says what it does? :D

Nope, they're not equivalent.

https://www.php.net/manual/en/filter.filters.sanitize.php

filisko commented 2 years ago

Fixed in https://github.com/Wixel/GUMP/pull/334