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

[5.1] Return numeric from query builder sum #18657

Conversation

nsnyder
Copy link

@nsnyder nsnyder commented Apr 4, 2017

The sum function in the Query Builder should return a numeric value.

That is how it is on 5.4.
And that is how it used to be on 5.1 before it was changed (and changed back, incorrectly)

This is related to issues #14793, and #14994

@taylorotwell
Copy link
Member

I'm really not comfortable changing this on the LTS release. Even if the behavior is kinda wonky it is what apps are depending on now and have possibly coded around.

@nsnyder
Copy link
Author

nsnyder commented Apr 4, 2017

Ok, but it already changed once (breaking things on our site) so I thought it would be a good opportunity to change it back. That's fine though. (Edit: I recognize that previously, it wouldn't force a numeric return, but would just return 0 instead of null. If you want, I can amend this request to do that, as it was previously, instead of always returning a numeric.)

@KnightVision90
Copy link

@taylorotwell It looks like the functionality of this method was broken when it was changed on #14793 and then reverted on #14994. Original functionality before the change and revert would at least return a 0 if the result was null, but now it just returns null.

Wouldn't this signify the behavior was broken and is now a bug? Even if we don't use the numericAggregate function we should at least check the results and return 0 if the value is falsy.

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.

3 participants