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

Ensure the user exists before calling a method on it #25652

Merged
merged 2 commits into from
Aug 11, 2016

Conversation

DeepDiver1975
Copy link
Member

@DeepDiver1975 DeepDiver1975 commented Jul 29, 2016

fixes #24751

stable9.1: #25776
stable9: #25777

@@ -293,12 +294,15 @@ public static function isDefaultExpireDateEnforced() {
* @return int Quota bytes
*/
public static function getUserQuota($user) {
$userQuota = \OC::$server->getUserManager()->get($user)->getQuota();
$user = \OC::$server->getUserManager()->get($user);
Copy link
Member

Choose a reason for hiding this comment

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

@DeepDiver1975 $user is reused. Rename argument to $uid?

Copy link
Member Author

Choose a reason for hiding this comment

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

I dont see an issue with this because the variable is not used further down

Copy link
Member

Choose a reason for hiding this comment

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

@DeepDiver1975 not a real issue, I just used to read "$user" as "object" and "$uid" as "string" recently.

Copy link
Member

Choose a reason for hiding this comment

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

I made it $userId which is more readable to also trigger jenkins.

@dragotin
Copy link
Contributor

dragotin commented Aug 2, 2016

looks 👍 apart from my question above.

@DeepDiver1975
Copy link
Member Author

If the user is not valid why return unlimited space? Wouldn't it be better to return zero?

unlimited was returned in this case from the very first day - see e2f04b3#diff-9b514c1773091768aa8f61c5b6d74b9fR76

@PVince81
Copy link
Contributor

PVince81 commented Aug 8, 2016

Nice catch, I didn't know we still had other relics of this issue... 👍

Jenkins sleeping ?

@butonic
Copy link
Member

butonic commented Aug 11, 2016

👍

@PVince81
Copy link
Contributor

Test failure unrelated, merging

@PVince81 PVince81 merged commit eaecf0c into master Aug 11, 2016
@PVince81 PVince81 deleted the fix-getQuota-on-null branch August 11, 2016 17:45
@PVince81
Copy link
Contributor

@butonic please submit backports

@DeepDiver1975 DeepDiver1975 self-assigned this Aug 11, 2016
@DeepDiver1975
Copy link
Member Author

@butonic please submit backports

I take care ....

DeepDiver1975 pushed a commit that referenced this pull request Aug 11, 2016
Ensure the user exists before calling a method on it
DeepDiver1975 pushed a commit that referenced this pull request Aug 11, 2016
Ensure the user exists before calling a method on it
PVince81 pushed a commit that referenced this pull request Aug 16, 2016
…e568b7bdde1bd49cfad73

[stable9.1] Merge pull request #25652 from owncloud/fix-getQuota-on-null
PVince81 pushed a commit that referenced this pull request Aug 16, 2016
Ensure the user exists before calling a method on it
PVince81 pushed a commit that referenced this pull request Aug 17, 2016
…68b7bdde1bd49cfad73

[stable9] Merge pull request #25652 from owncloud/fix-getQuota-on-null
@lock
Copy link

lock bot commented Aug 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Public upload: Call to a member function getQuota() on null in lib/private/util.php on line 289
5 participants