-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Request->getHeader() should always return a string #7813
Conversation
@@ -324,7 +324,7 @@ public function getHeader($name) { | |||
|
|||
} | |||
|
|||
return null; | |||
return ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking public API :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really - the public API says: @return string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this fixes the public API, because you can see, that many apps use it like it will always return a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apart from apps that checked the actual return instead of trusting the docs :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well we should communicate all this properly. But at some point we want to fix the code. I would vote to actually cleanup the code. It is not like we have a million apps that depend on all this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I was just saying that "communicate" is the important word.
I'd really like to use @nextcloud/maintainers
or something like that to mention such important cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us collect this in a separate ticket for 14. Because I guess there will be more to come.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test fail
b0bf116
to
fc576cd
Compare
Codecov Report
@@ Coverage Diff @@
## master #7813 +/- ##
============================================
+ Coverage 51.23% 51.23% +<.01%
Complexity 24919 24919
============================================
Files 1604 1604
Lines 94966 94969 +3
Branches 1376 1376
============================================
+ Hits 48656 48659 +3
Misses 46310 46310
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 lets do this!
still fail ;) |
fe4ab92
to
90495c1
Compare
PHPDoc (of the public API) says that this method returns string but it also returns null, which is not allowed in some method calls. This fixes that behaviour and returns an empty string and fixes all code paths that explicitly checked for null to be still compliant. Found while enabling the strict_typing for lib/private for the PHP7+ migration. Signed-off-by: Morris Jobke <[email protected]>
90495c1
to
4ef302c
Compare
Fixed the tests. |
Was basically the stuff in https://github.com/nextcloud/server/pull/7813/files#diff-9889f094c61189d26dace2f6e224459f |
PHPDoc (of the public API) says that this method returns string but it also returns null, which is not allowed in some method calls. This fixes that behaviour and returns an empty string and fixes all code paths that explicitly checked for null to be still compliant.
Found while enabling the strict_typing for lib/private for the PHP7+ migration. (#7392)
The only app that uses this as well is activity and I will create a PR for that as well.