custom-post-type-ui icon indicating copy to clipboard operation
custom-post-type-ui copied to clipboard

Confirm PHP 8.0 compatibility

Open tw2113 opened this issue 3 years ago • 2 comments

tw2113 avatar Sep 22 '22 17:09 tw2113

Add or edit:

Constant FILTER_SANITIZE_STRING is deprecated

wp-content/plugins/custom-post-type-ui/inc/post-types.php:2454 wp-content/plugins/custom-post-type-ui/inc/post-types.php:2474 wp-content/plugins/custom-post-type-ui/inc/utility.php:596 wp-content/plugins/custom-post-type-ui/inc/utility.php:603 wp-content/plugins/custom-post-type-ui/inc/taxonomies.php:2069 wp-content/plugins/custom-post-type-ui/inc/taxonomies.php:2082

Needs security sanitization reworking

trim(): Passing null to parameter #1 ($string) of type string is deprecated

wp-content/plugins/custom-post-type-ui/inc/post-types.php:2084

could be fixed with:

trim( isset( $data['cpt_custom_post_type']['menu_icon'] ) ? $data['cpt_custom_post_type']['menu_icon'] : '' )

but if we can upgrade to requiring PHP 7+, we could fix with

trim( $data['cpt_custom_post_type']['menu_icon'] ?? '' )

tw2113 avatar Sep 27 '22 19:09 tw2113

I feel like parts of this would be really good to have once we get to the point of having stronger unit tests.

I'm seeing FILTER_SANITIZE_FULL_SPECIAL_CHARS as available, and it has this description:

Equivalent to calling htmlspecialchars() with ENT_QUOTES set. Encoding quotes can be disabled by setting FILTER_FLAG_NO_ENCODE_QUOTES. Like htmlspecialchars(), this filter is aware of the default_charset and if a sequence of bytes is detected that makes up an invalid character in the current character set then the entire string is rejected resulting in a 0-length string. When using this filter as a default filter, see the warning below about setting the default flags to 0.

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

tw2113 avatar Sep 27 '22 19:09 tw2113

Merged in to release1140 branch

tw2113 avatar Oct 24 '22 20:10 tw2113