Skip to content

Commit

Permalink
Update User_LDAP.php
Browse files Browse the repository at this point in the history
fixes this error caused when system has usernames that are purely numeric.

An unhandled exception has been thrown:
Error: Object of class OCA\User_LDAP\User\User could not be converted to string in /var/www/nextcloud/apps/user_ldap/lib/User_LDAP.php:312
Stack trace:
#0 [internal function]: OCA\User_LDAP\User_LDAP->userExistsOnLDAP()
nextcloud#1 /var/www/nextcloud/apps/user_ldap/lib/User_Proxy.php(126): call_user_func_array()
nextcloud#2 /var/www/nextcloud/apps/user_ldap/lib/Proxy.php(140): OCA\User_LDAP\User_Proxy->walkBackends()
nextcloud#3 /var/www/nextcloud/apps/user_ldap/lib/User_Proxy.php(262): OCA\User_LDAP\Proxy->handleRequest()
nextcloud#4 /var/www/nextcloud/apps/user_ldap/lib/User_Proxy.php(239): OCA\User_LDAP\User_Proxy->userExistsOnLDAP()
nextcloud#5 /var/www/nextcloud/lib/private/User/Manager.php(168): OCA\User_LDAP\User_Proxy->userExists()
nextcloud#6 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(399): OC\User\Manager->get()
nextcloud#7 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(226): OCA\Files_FullTextSearch\Service\FilesService->initFileSystems()
nextcloud#8 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(246): OCA\Files_FullTextSearch\Service\FilesService->getChunksFromUser()
nextcloud#9 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(174): OCA\Files_FullTextSearch\Provider\FilesProvider->generateChunks()
nextcloud#10 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(403): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser()
nextcloud#11 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(280): OCA\FullTextSearch\Command\Index->indexProvider()
nextcloud#12 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\FullTextSearch\Command\Index->execute()
nextcloud#13 /var/www/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()
nextcloud#14 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()
nextcloud#15 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
nextcloud#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
nextcloud#17 /var/www/nextcloud/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run()
nextcloud#18 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
nextcloud#19 /var/www/nextcloud/occ(11): require_once('...')
nextcloud#20 {main}roopico /var/www/nextcloud/apps/user_ldap/lib/User/OfflineUser.phparch:index


Signed-off-by: Alexie Papanicolaou <alpapan@gmail.com>
  • Loading branch information
alpapan authored Feb 7, 2024
1 parent 52d0b9a commit b74d75a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/User_LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function getUsers($search = '', $limit = 10, $offset = 0) {
* @throws \OC\ServerNotAvailableException
*/
public function userExistsOnLDAP($user, bool $ignoreCache = false): bool {
if (is_string($user)) {
if (is_string($user) || is_int($user)) { # usernames can be numeric
$user = $this->access->userManager->get($user);
}
if (is_null($user)) {
Expand Down

0 comments on commit b74d75a

Please sign in to comment.