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

fix: Prevent null array offset errors in Provider.php for ORCID #1143

Merged
merged 1 commit into from
Feb 1, 2024
Merged

Conversation

gmeben
Copy link
Contributor

@gmeben gmeben commented Jan 30, 2024

In the event user data in the response from ORCID does not have a supplied name, an "array offset" error will be encountered because the value key won't exist as it's currently specified.

"Family names" (or last names) are considered optional by ORCID, which means $user['person']['name']['family-name'] won't always have a ['value'] key available.

For the moment, "given names" (or first names) are required by ORCID so there's no problem assuming this ['value'] information will exist in the response, but if ORCID ever does the right thing and makes "given names" optional, this will cause errors. It would be a good idea to future proof this with a null coalesce as well. My solution also reduces code duplication.

@atymic atymic merged commit 1306558 into SocialiteProviders:master Feb 1, 2024
5 checks passed
@gmeben gmeben deleted the patch-1 branch February 1, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants