-
Notifications
You must be signed in to change notification settings - Fork 824
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
UnsavedRelationList::first() / last() return false instead of null when list is empty #11083
Comments
I'm of the opinion that If this is new as of CMS 5, then I doubt anyone else has even noticed the changed return type. tl;dr: I'd support this being patched rather than waiting for a major release. But we should probably get at least one more opinion. @silverstripe/core-team any other opinions? |
patch 👍 |
+1 for patch |
Thanks all, PR raised |
FIX: UnsavedRelationList first/last to return null if list is empty (fixes #11083)
Merged. Will be automatically tagged and merged up by GitHub actions |
Pull request: #11085
Affected Version
5.x
Description
UnsavedRelationList::first()
andUnsavedRelationList::last()
returnfalse
instead ofnull
when the list is empty. This is inconsistent withDataList
and co, which returnnull
. Cause is the use ofreset()
andend()
:silverstripe-framework/src/ORM/UnsavedRelationList.php
Lines 238 to 248 in 809f9e7
silverstripe-framework/src/ORM/UnsavedRelationList.php
Lines 255 to 262 in 809f9e7
I suppose there’s a minor BC risk to changing this, open to feedback on whether this is appropriate for a patch release.
The text was updated successfully, but these errors were encountered: