diff --git a/tests/integration/API/CacheableAPIBaseTest.php b/tests/integration/API/CacheableAPIBaseTest.php index 95729b3c4..563060743 100644 --- a/tests/integration/API/CacheableAPIBaseTest.php +++ b/tests/integration/API/CacheableAPIBaseTest.php @@ -25,7 +25,7 @@ class CacheableAPIBaseTest extends \Codeception\TestCase\WPTestCase { * * @throws ReflectionException */ - public function test_do_remote_request( bool $is_cacheable, bool $force_refresh = null, bool $cache_exists = null, bool $should_load_from_cache = false ) { + public function test_do_remote_request( bool $is_cacheable, ?bool $force_refresh = null, ?bool $cache_exists = null, bool $should_load_from_cache = false ) { $request = $this->get_new_request_instance( $is_cacheable ); @@ -357,7 +357,7 @@ public function provider_get_request_cache_lifetime(): array { * * @throws ReflectionException */ - public function test_get_request_data_for_broadcast( bool $is_cacheable, bool $force_refresh = null, bool $should_cache = null ) { + public function test_get_request_data_for_broadcast( bool $is_cacheable, ?bool $force_refresh = null, ?bool $should_cache = null ) { $request = $this->get_new_request_instance( $is_cacheable ); diff --git a/woocommerce/Helpers/OrderHelper.php b/woocommerce/Helpers/OrderHelper.php index 52f7a36a8..3d2862234 100644 --- a/woocommerce/Helpers/OrderHelper.php +++ b/woocommerce/Helpers/OrderHelper.php @@ -78,7 +78,7 @@ public static function get_customer_id( \WC_Order $order ) { * @param mixed $default Optional. The default value if the property doesn't exist. Default null. * @return mixed The property value if found, or the default value if not found. */ - public static function get_property( \WC_Order $order, string $key, $nested_key = null, $default = null ): mixed { + public static function get_property( \WC_Order $order, string $key, $nested_key = null, $default = null ) { return Dynamic_Props::get( $order, $key, $nested_key, $default ); } diff --git a/woocommerce/payment-gateway/Dynamic_Props.php b/woocommerce/payment-gateway/Dynamic_Props.php index 609ed2107..6ccf833be 100644 --- a/woocommerce/payment-gateway/Dynamic_Props.php +++ b/woocommerce/payment-gateway/Dynamic_Props.php @@ -42,7 +42,7 @@ class Dynamic_Props { * @since x.x.x * @var \WeakMap|null */ - private static ?\WeakMap $map = null; + private static ?\WeakMap $map = null; // phpcs:ignore PHPCompatibility.Classes.NewClasses.weakmapFound -- conditionally used for PHP 8.0+ /** * Sets a property on the order object. @@ -64,7 +64,7 @@ class Dynamic_Props { * Dynamic_Props::set($order, 'payment_total', '99.99'); * ``` */ - public static function set( \WC_Order &$order, string $key, mixed $value ): void { + public static function set( \WC_Order &$order, string $key, $value ): void { if ( self::use_weak_map() ) { self::init_weak_map(); if ( ! isset( self::$map[ $order ] ) ) { @@ -97,7 +97,7 @@ public static function set( \WC_Order &$order, string $key, mixed $value ): void * $token = Dynamic_Props::get($order, 'payment', 'token', 'DEFAULT_TOKEN'); * ``` */ - public static function get( \WC_Order $order, string $key, $nested_key = null, $default = null ): mixed { + public static function get( \WC_Order $order, string $key, $nested_key = null, $default = null ) { if ( self::use_weak_map() ) { self::init_weak_map(); if ( is_null( $nested_key ) ) { @@ -184,6 +184,7 @@ private static function use_weak_map(): bool { */ private static function init_weak_map(): void { if ( null === self::$map ) { + // phpcs:ignore PHPCompatibility.Classes.NewClasses.weakmapFound -- conditionally used for PHP 8.0+ self::$map = new \WeakMap(); } } diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php index 4185a7c26..50b5fe054 100644 --- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php +++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway-direct.php @@ -484,7 +484,7 @@ protected function get_notices_as_user_messages( ?string $type = null ) : array $message = $notice['notice'] ?? $notice; // this will handle some log data eventually - $messages[] = htmlspecialchars( is_array( $message ) ? print_r( $message, true ) : $message ); + $messages[] = htmlspecialchars( is_array( $message ) ? print_r( $message, true ) : $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ); } } diff --git a/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php b/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php index 39de01002..c821269fe 100755 --- a/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php +++ b/woocommerce/payment-gateway/class-sv-wc-payment-gateway.php @@ -3753,12 +3753,12 @@ public function add_debug_message( $message, ?string $type = 'message' ) : void if ( 'message' === $type ) { - SV_WC_Helper::wc_add_notice( str_replace( "\n", "
", htmlspecialchars( $message ) ), 'notice' ); + SV_WC_Helper::wc_add_notice( str_replace( "\n", "
", htmlspecialchars( $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ), 'notice' ); } else { // defaults to error message - SV_WC_Helper::wc_add_notice( str_replace( "\n", "
", htmlspecialchars( $message ) ), 'error' ); + SV_WC_Helper::wc_add_notice( str_replace( "\n", "
", htmlspecialchars( $message, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ), 'error' ); } } }