#45886 [NEW]: ldap_bind fails with out of memory

[email protected] ("rocko823 at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             rocko823 at gmail dot com
Operating system: Solaris 10 SPARC
PHP version:      5.2.6
PHP Bug Type:     LDAP related
Bug description:  ldap_bind fails with out of memory

Description:
------------
PHP 5.2.6 with Apache 2.2.9 with this configure: './configure'
'--with-apxs2=/web/apache/bin/apxs' '--with-mysql=/local/mysql32'
'--with-gd' '--with-jpeg-dir=/usr/local/' '--with-zlib'
'--with-oci8=instantclient,/local/instantclient_10_2' '--with-mcrypt'
'--with-ldap' '--with-ldap-sasl' '--with-openssl=/usr/local/ssl'

with openldap 2.3.39

When ldap_connect then ldap_bind is run it fails with ldap error "Out of
memory" only when run under Apache 2 module, with the command line client
it runs correctly.

Reproduce code:
---------------
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
$ds=ldap_connect("ldap://server");

if ($ds) {
    $r=@ldap_bind($ds, "user", "password");
    if ($r) {
       echo "success";
    } else {
       echo "fail:" . ldap_error($ds);
    }
}


Expected result:
----------------
PHP connects and binds to the LDAP server and returns success

Actual result:
--------------
PHP returns ldap error "Out of memory".  PHP doesn't even try to connect
to the LDAP server.  In the apache error logs I see these ldap debugging
messages:
ldap_create
ldap_url_parse_ext(ldap://server)
ldap_bind_s
ldap_simple_bind_s
ldap_sasl_bind_s
ldap_sasl_bind

and it stops there where when run with the command line and a success
there are many more lines

-- 
Edit bug report at http://bugs.php.net/?id=45886&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45886&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45886&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45886&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45886&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45886&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45886&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45886&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45886&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45886&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45886&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45886&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45886&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45886&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45886&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45886&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45886&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45886&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45886&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45886&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45886&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.