Fix unsupported operand types PHP error