Skip to content

Comments

Return an empty array if fieldTag is empty in MarcReader#16

Merged
demiankatz merged 4 commits intovufind-org:devfrom
LuomaJuha:return-if-empty-string
Apr 21, 2025
Merged

Return an empty array if fieldTag is empty in MarcReader#16
demiankatz merged 4 commits intovufind-org:devfrom
LuomaJuha:return-if-empty-string

Conversation

@LuomaJuha
Copy link
Contributor

@LuomaJuha LuomaJuha commented Apr 16, 2025

Noticed a small thing, but if there is an empty string value passed into the getFields by accident, it will pass through the if ($fieldTag &&... check and return first found field instead of an empty array

If this was an intentional behaviour, then this can be ignored and will close the pr.

@LuomaJuha LuomaJuha added the question Further information is requested label Apr 16, 2025
Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LuomaJuha, this makes sense to me! I confirmed that in PHP, the string '0' resolves to false but the string '000' resolves to true. I am not aware of any case where there's a 000 field in MARC, but if there were for some reason, this change would not break anything.

@demiankatz demiankatz merged commit 05f4225 into vufind-org:dev Apr 21, 2025
3 checks passed
@demiankatz
Copy link
Member

@LuomaJuha, I've also released this as vufind-marc v1.2.0; feel free to open a PR against the release-10.2 branch of the main repository if you want to update this dependency right away; otherwise, it will get addressed soon anyway as part of the routine dependency updates for the 10.2 release.

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

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants