Make sure payment gateway title is a string before sanitizing (#33434)
Make sure payment gateway title is a string before sanitizing. * Add changelog * Drop type-hint in `validate_safe_text_field()` * Update plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
This commit is contained in:
parent
55eebebeba
commit
f0b9adc7ae
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Make sure payment gateway title is a string before sanitizing
|
|
@ -305,7 +305,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
|
|||
* @return string
|
||||
*/
|
||||
public function get_title() {
|
||||
$title = wc_get_container()->get( HtmlSanitizer::class )->sanitize( $this->title, HtmlSanitizer::LOW_HTML_BALANCED_TAGS_NO_LINKS );
|
||||
$title = wc_get_container()->get( HtmlSanitizer::class )->sanitize( (string) $this->title, HtmlSanitizer::LOW_HTML_BALANCED_TAGS_NO_LINKS );
|
||||
return apply_filters( 'woocommerce_gateway_title', $title, $this->id );
|
||||
}
|
||||
|
||||
|
|
|
@ -868,8 +868,8 @@ abstract class WC_Settings_API {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function validate_safe_text_field( string $key, string $value ): string {
|
||||
return wc_get_container()->get( HtmlSanitizer::class )->sanitize( $value, HtmlSanitizer::LOW_HTML_BALANCED_TAGS_NO_LINKS );
|
||||
public function validate_safe_text_field( string $key, ?string $value ): string {
|
||||
return wc_get_container()->get( HtmlSanitizer::class )->sanitize( (string) $value, HtmlSanitizer::LOW_HTML_BALANCED_TAGS_NO_LINKS );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue