Uh oh!
There was an error while loading. Please reload this page.
Bugfix - Prevent PHP Warning for count on null on LDAP - #20123
Conversation
georgehrke
commented
Mar 24, 2020
@lippl Is this related to any existing issue? |
georgehrke
commented
Mar 24, 2020
@lippl Can you please add unit tests for it? Thx! |
blizzz
commented
Mar 24, 2020
@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.
If you only count to see you have more than 0 items, use !empty()
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lippl
commented
Mar 25, 2020
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. |
blizzz
commented
Mar 25, 2020
fine with me :) |
2f52660 to
58bc784CompareSigned-off-by: Philipp Staiger <philipp@staiger.it>
58bc784 to
8769d97Compareblizzz
commented
Mar 26, 2020
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 |
blizzz
commented
Mar 26, 2020
/backport to stable18 |
blizzz
commented
Mar 26, 2020
/backport to stable17 |
blizzz
commented
Mar 26, 2020
/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.