Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

== used instead of .equals() for String comparison #1027

Open
sakshipatil1305 opened this issue Oct 24, 2024 · 1 comment
Open

== used instead of .equals() for String comparison #1027

sakshipatil1305 opened this issue Oct 24, 2024 · 1 comment

Comments

@sakshipatil1305
Copy link

[REQUIRED] Step 2: Describe your environment

  • Operating System version: macOS 14.3
  • Firebase SDK version: 9.4.1
  • Library version: _____
  • Firebase Product: _____ (auth, database, storage, etc)

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

Currently we are using "==" for string comparison . == compares the reference values, so if two variables reference different objects, they will not be equal using == . This can cause potential bugs while using the sdk

Relevant Code:

snipped from AbstractFirebaseAuth : 603
if (providerId == "phone") {
return this.getUserByPhoneNumberOp(uid);
} else if (providerId == "email") {
return this.getUserByEmailOp(uid);
}

solution:

   if ("phone".equals(providerId)) {
      return this.getUserByPhoneNumberOp(uid);
    } else if ( "email".equals(providerId)) {
      return this.getUserByEmailOp(uid);
    }
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants