vyskoczilova / woocommerce-payforpayment

WordPress plugin WooCommerce Pay for Payment
13 stars 11 forks source link

Tax class can not be changed - PHP 8 #70

Open dvorakvaclav opened 1 year ago

dvorakvaclav commented 1 year ago

Tax class can not be changed in gateway settings because of this function used in update_payment_options():

private function _sanitize_tax_class( $tax_option, $default = 'incl' ) {
      if ( in_array( $tax_option, array( 0, 'incl', 'excl' ) ) )
          return $tax_option;
      return $default;
}

In php 7 the condition returns true for every string, but in php 8 only 0, inc and excl pass.

vyskoczilova commented 1 year ago

Hi! I haven't tested it, but it should return 0, inc, and excl, both in PHP 7 and 8. I don't see any reason to return true. How can I reproduce the error?