pear / Net_LDAP2

Object oriented interface for searching and manipulating LDAP-entries
http://pear.php.net/package/Net_LDAP2
GNU Lesser General Public License v3.0
10 stars 6 forks source link

PHP8 error #7

Closed alecpl closed 11 months ago

alecpl commented 1 year ago

One of our users reported this:

[08-Feb-2023 06:11:53 UTC] PHP Fatal error:  Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in /roundcubemail-1.5.3/vendor/pear/net_ldap2/Net/LDAP2.php:640
Stack trace:
#0 /roundcubemail-1.5.3/vendor/pear/net_ldap2/Net/LDAP2.php(640): in_array()
#1 /roundcubemail-1.5.3/vendor/pear/net_ldap2/Net/LDAP2.php(444): Net_LDAP2->startTLS()
#2 /roundcubemail-1.5.3/vendor/pear/net_ldap2/Net/LDAP2.php(339): Net_LDAP2->performConnect()
#3 /roundcubemail-1.5.3/vendor/pear/net_ldap2/Net/LDAP2.php(207): Net_LDAP2->bind()
#4 /roundcubemail-1.5.3/plugins/password/drivers/ldap.php(177): Net_LDAP2::connect()
hbeni commented 1 year ago

Thats this here: https://github.com/pear/Net_LDAP2/blob/0cbfdadca4b55cb7543ad0a6b994fe0e4ed5c3c1/Net/LDAP2.php#L640

What LDAP server are you connected to?

alecpl commented 1 year ago

Active Directory (Samba 4), but I have no more details. https://www.roundcubeforum.net/index.php/topic,30282.msg76701.html#msg76701

Obviously the variable here might be an array, string or even bool, if I read the code correctly.

hbeni commented 1 year ago

Your assumtion is correct: https://github.com/pear/Net_LDAP2/blob/0cbfdadca4b55cb7543ad0a6b994fe0e4ed5c3c1/Net/LDAP2/Entry.php#L459

I think there should be a check. However, the question is, why don't we get an array here - is the server not capable of startTLS?


ref RFC 4511: https://www.rfc-editor.org/rfc/rfc4511