Core components for the WordPress payment processing library. This library is used in the WordPress plugin Pronamic Pay: https://www.pronamicpay.com/, but also allows other plugin developers to set up a payment plugin.
The code is working fine if we pass the 'key' as a string in the options array. But if the 'key' is of integer type or some other data type, the "selected" attribute is not getting updated. This happens because the value is saved in the database as a "string" even for the 'int' type key in options. Do you suggest using string keys instead of int keys?
I would suggest to use == instead of === operator. Or we can also convert the $key to a string before comparing it with the $value. What do you suggest?
The code is working fine if we pass the 'key' as a string in the options array. But if the 'key' is of integer type or some other data type, the "selected" attribute is not getting updated. This happens because the value is saved in the database as a "string" even for the 'int' type key in options. Do you suggest using string keys instead of int keys?
example: Working fine
Not Working fine
https://github.com/pronamic/wp-pay-core/blob/a34a2f0b7178649e901aaa64fd28f59d65463289/views/meta-box-gateway-settings.php#L361
I would suggest to use
==
instead of===
operator. Or we can also convert the$key
to a string before comparing it with the$value
. What do you suggest?