#1077759 gosa: failed to change user entry: Uncaught ReflectionException: Property LDAP::$count does not exist

#1077759#5
Date:
2024-08-01 14:12:34 UTC
From:
To:
Dear Maintainer,

I recently noticed, that I cannot edit properties of a user account
in the GOsa web interface anymore.
This applies to my own account as well as other people's accounts in an
admin context.

I am running Debian Bookworm and I am not aware of any special
ingredients in the affected system.

Example procedure:
1. log into GOsa as a user
1. select "Edit user settings" (the wording is not exact; I am using the
   German localization)
1. click "Edit"
1. change one of the user properties (e.g. first name, academic title,
   birthday, ...)
1. click "OK"

The following error message is emitted now:

Fatal error: Uncaught ReflectionException:
Property LDAP::$count does not exist in /usr/share/gosa/include/class_ldapMultiplexer.inc:55
Stack trace:
 #0 /usr/share/gosa/include/class_ldapMultiplexer.inc(55): ReflectionProperty->__construct()
 #1 /usr/share/gosa/plugins/personal/generic/class_user.inc(1357): ldapMultiplexer->__get()
 #2 /usr/share/gosa/include/class_tabs.inc(412): user->check()
 #3 /usr/share/gosa/plugins/personal/myaccount/main.inc(87): tabs->check()
 #4 /usr/share/gosa/html/main.php(427): require('...')
 #5 {main} thrown in /usr/share/gosa/include/class_ldapMultiplexer.inc on line 55

A reboot of the host providing GOSa did not change this behavior.

I *think*, the above procedure was working before, but I am not aware
of any local changes.

Do you have an idea, what could cause this error message?

Thank you for your time!

Lars

#1077759#10
Date:
2024-09-06 11:27:16 UTC
From:
To:
Hello,

now I realized, that this problem does not only affect account modifications,
but also the creation of new accounts.

I took a closer look at the problematic code in
`plugins/personal/generic/class_user.inc` around line 1355:

```
if ($this->config->get_cfg_value("core","accountPrimaryAttribute") != "uid"){
  $ldap->cat($this->new_dn);
  if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
    $message[]= msgPool::duplicated(_("Name"));
  }
}
```

The above code was changed in 2022 (f9076ea89512):

```
- $ldap->cat($this->new_dn);
- if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
+ $ldap->cat($ldap->count);
+ if ($ldap->count != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){
```

I lack the understanding for the `cat()` call.
But the direct `ldap->count` access (instead of `ldap->count()`) looks weird to
me.

In the end I decided to disable (comment) the whole `if` block (see the first
code quotation). Now the code does not check for duplicate uid entries anymore,
but at least we can create and modify user accounts again.

Cheers,
Lars