-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Bugfix - Prevent PHP Warning for count on null on LDAP #20123
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
Conversation
|
@lippl Is this related to any existing issue? |
|
@lippl Can you please add unit tests for it? Thx! |
|
@lippl looks good from my point of view, just perhaps you can stash the commits into one? |
nickvergessen
left a comment
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.
If you only count to see you have more than 0 items, use !empty()
I have not found any open issue for this yet but rather decided to go straight for a fix
@nickvergessen Thanks for the hint! I applied your suggested changes and also extended this to the initial
If that is all fine with you, I would squash everything into one commit. |
fine with me :) |
2f52660 to
58bc784
Compare
Signed-off-by: Philipp Staiger <philipp@staiger.it>
58bc784 to
8769d97
Compare
|
Thanks @lippl |
|
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
|
/backport to stable18 |
|
/backport to stable17 |
|
/backport to stable16 |
|
backport to stable18 in #20175 |
|
backport to stable17 in #20176 |
|
backport to stable16 in #20177 |
When initializing the
$pwdGraceUseTimeCountit is not checked if the$pwdGraceUseTimemay benull, when pwdgraceusetime attribute my be not defined in LDAP. Starting PHP 7.2 count throws a warning when called onnull.[PHP 7.2] count(): Parameter must be an array or an object that implements CountableAs the ldap search also only returns arrays,
[]is used instead ofnull.The redundant check for the variable in the if query is also removed, as only arryas, which implement countable, can be passed.
Additionally this is harmonized for all other LDAP attributes querried within the
handlePasswordExpiryfunction.