After doing an update from 2.4.2 to 2.4.6 I am getting that error on compilation in compilation step 5 rfunning PHP 8.1. I searched a bit and found setup:di:compile fails after update to magento 2.4.4. I applied this solution, which gives me another error in compilation step 3:
Cannot use isset() on the result of an expression
So, any idea how to solve this problem?
Thanks!