shopware
shopware copied to clipboard
Missing bool casting in CustomerCustomFieldRule.php
PHP Version
8.0
Shopware Version
6.4.11.1
Expected behaviour
In the rule builder it should be possible to set a bool value for comparison with a customer custom field.
Actual behaviour
This is not working. Because of the missing cast the real value and the expected value are always compared wrong:
true === 'true'
How to reproduce
- Create a custom field for a customer with switch or bool type
- create a rule for a payment method or something else which only should appear if the customer has the corresponding custom field set.
- It will not appear even if the custom field is set.
This is the line where the (bool)
cast should be applied:
https://github.com/shopware/platform/blob/dea144715a735c2b6f53098b9c92f9eeebc16c21/src/Core/Checkout/Customer/Rule/CustomerCustomFieldRule.php#L164
Could please provide a PR with your proposed fix? And if possible also with an unit test, that fails without that fix.
There is already a PR, i will close this