When adding a new server with the Binding Method of "Anonymous Bind" the page will not save and throws the following php error.

The website encountered an unexpected error. Please try again later.
Error: Call to a member function get() on null in Drupal\ldap_servers\Form\ServerForm->save() (line 501 of /Users//d8/modules/contrib/ldap/ldap_servers/src/Form/ServerForm.php).

Line 498 just above it says in the comments, "If there isn't a password then load the existing one". There will not be a password for anonymous binding so this code always runs. It then tries to load a server that doesn't exist yet.

CommentFileSizeAuthor
#5 ldap_server_anonymous-2719827-5.patch1.06 KBgrahl

Comments

segovia94 created an issue. See original summary.

queenvictoria’s picture

Good catch. I'll fix that thanks.

  • queenvictoria committed 0857233 on 8.x-3.x
    Issue #2719827 by queenvictoria: Ldap Server: Anonymous Bind causes php...
queenvictoria’s picture

Status: Active » Fixed
grahl’s picture

Status: Fixed » Needs work
StatusFileSize
new1.06 KB

The issue is not fully fixed, when you do use a service account and no password is set for some reason (even if it should be), saving also fails. Attached is a quick check for this. One could amend that to provide the user some feedback that the password was missing, or have more stricter form checking (this seems a bit broken currently, with the fields being read-only for service accounts).

larowlan’s picture

Status: Needs work » Reviewed & tested by the community
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

  • larowlan committed 6c4edc1 on 8.x-3.x authored by grahl
    Issue #2719827 by grahl: Ldap Server: Anonymous Bind causes php error...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.