Using docker image php:7.4-cli everything seems OK, in output
PHP version : 7.4.33
Net_LDAP2::connect() OK
Net_LDAP2->done() OK
With php:8.0-cli
PHP version : 8.0.30
Net_LDAP2::connect() OK
Net_LDAP2->done() OK
Fatal error: Uncaught TypeError: ldap_close(): supplied resource is not a valid ldap link resource in /app/vendor/pear/net_ldap2/Net/LDAP2.php:701
Stack trace:
#0 /app/vendor/pear/net_ldap2/Net/LDAP2.php(701): ldap_close(Resource id #21)
#1 /app/vendor/pear/pear-core-minimal/src/PEAR.php(812): Net_LDAP2->_Net_LDAP2()
#2 [internal function]: _PEAR_call_destructors()
#3 {main}
thrown in /app/vendor/pear/net_ldap2/Net/LDAP2.php on line 701
With php:8.1-cli same error. There are Deprecated warnings too, but seems unrelated
PHP version : 8.1.30
Deprecated: Return type of Net_LDAP2_Search::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/vendor/pear/net_ldap2/Net/LDAP2/Search.php on line 565
Deprecated: Return type of Net_LDAP2_Search::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/vendor/pear/net_ldap2/Net/LDAP2/Search.php on line 596
Deprecated: Return type of Net_LDAP2_Search::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/vendor/pear/net_ldap2/Net/LDAP2/Search.php on line 581
Deprecated: Return type of Net_LDAP2_Search::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/vendor/pear/net_ldap2/Net/LDAP2/Search.php on line 619
Deprecated: Return type of Net_LDAP2_Search::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /app/vendor/pear/net_ldap2/Net/LDAP2/Search.php on line 632
Net_LDAP2::connect() OK
Net_LDAP2->done() OK
Fatal error: Uncaught Error: LDAP connection has already been closed in /app/vendor/pear/net_ldap2/Net/LDAP2.php:701
Stack trace:
#0 /app/vendor/pear/net_ldap2/Net/LDAP2.php(701): ldap_close(Object(LDAP\Connection))
#1 /app/vendor/pear/pear-core-minimal/src/PEAR.php(812): Net_LDAP2->_Net_LDAP2()
#2 [internal function]: _PEAR_call_destructors()
#3 {main}
thrown in /app/vendor/pear/net_ldap2/Net/LDAP2.php on line 701
Hi
Using Net_LDAP2 2.3.0 a Fatal error is thrown by the destructor on PHP 8.0+
Minimal code
Using docker image php:7.4-cli everything seems OK, in output
With php:8.0-cli
With php:8.1-cli same error. There are Deprecated warnings too, but seems unrelated