Title: Error on PHP8.1 when user does not exist
Last modified: October 5, 2023

---

# Error on PHP8.1 when user does not exist

 *  [rwahyudi](https://wordpress.org/support/users/rwahyudi/)
 * (@rwahyudi)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/error-on-php8-1-when-user-does-not-exist/)
 * Login using non existant user will take user to critical error page and admin
   will receive email.
 *     ```wp-block-code
       Error Details
       =============
       An error of type E_ERROR was caused in line 491 of the file /web/public_html/wp-content/plugins/wpdirauth/wpDirAuth.php. Error message: Uncaught TypeError: ldap_get_dn(): Argument #2 ($entry) must be of type LDAP\ResultEntry, bool given in /web/public_html/wp-content/plugins/wpdirauth/wpDirAuth.php:491
       Stack trace:
       #0 /web/public_html/wp-content/plugins/wpdirauth/wpDirAuth.php(491): ldap_get_dn(Object(LDAP\Connection), false)
       #1 /web/public_html/wp-content/plugins/wpdirauth/wpDirAuth.php(1379): wpDirAuth_auth('nonexistentuser', 'SomePassword...')
       #2 /web/public_html/wp-includes/class-wp-hook.php(310): wpDirAuth_authenticate(NULL, 'nonexistentuser', 'SomePassword...')
       #3 /web/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(NULL, Array)
       #4 /web/public_html/wp-includes/pluggable.php(618): apply_filters('authenticate', NULL, 'nonexistentuser', 'SomePassword...')
       #5 /web/public_html/wp-includes/user.php(106): wp_authenticate('nonexistentuser', 'SomePassword...')
       #6 /web/public_html/wp-login.php(1241): wp_signon(Array, true)
       #7 {main}
         thrown
       ```
   
 * WordPress version 6.3.1
   Active theme: Newspaper (version 10.4)Current plugin:
   wpDirAuth (version 1.10.7)PHP version 8.1.24
    -  This topic was modified 2 years, 8 months ago by [rwahyudi](https://wordpress.org/support/users/rwahyudi/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [Paul Gilzow](https://wordpress.org/support/users/gilzow/)
 * (@gilzow)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/error-on-php8-1-when-user-does-not-exist/#post-17103225)
 * oh, boy. this one is going to be fun to debug….
 * to get to line 491, you would have had to have a valid return (non boolean false)
   at line 490 for 
   `$results = @ldap_search($connection, $baseDn, $filterQuery,
   $returnKeys)) !== **false**`
 * A return of `false` would indicate a _failure_ from `ldap_first_entry` and not
   just an empty return set.
 * Is there anything else in your logs that might shed some light on why the call
   to `ldap_first_entry` failed?
 * Can you try running this script (and adding in the necessary info) [https://github.com/gilzow/simple-ldap-test/blob/master/ldap.php](https://github.com/gilzow/simple-ldap-test/blob/master/ldap.php)
   on your instance to help debug ?
    -  This reply was modified 2 years, 8 months ago by [Paul Gilzow](https://wordpress.org/support/users/gilzow/).
      Reason: mentioned wrong ldap method

Viewing 1 replies (of 1 total)

The topic ‘Error on PHP8.1 when user does not exist’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wpdirauth.svg)
 * [wpDirAuth](https://wordpress.org/plugins/wpdirauth/)
 * [Support Threads](https://wordpress.org/support/plugin/wpdirauth/)
 * [Active Topics](https://wordpress.org/support/plugin/wpdirauth/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpdirauth/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpdirauth/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Paul Gilzow](https://wordpress.org/support/users/gilzow/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/error-on-php8-1-when-user-does-not-exist/#post-17103225)
 * Status: not resolved