Bug #72064 [NEW]: ldap_connect sees correct args as *uninitialized*
| From: | hcoin at quietfountain dot com | Date: | Wed, 20 Apr 2016 13:49:02 +0000 |
| Subject: | Bug #72064 [NEW]: ldap_connect sees correct args as *uninitialized* | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200659@lists.php.net to get a copy of this message | ||
From: hcoin at quietfountain dot com
Operating system: Ubuntu xenial
PHP version: 5.6.20
Package: LDAP related
Bug Type: Bug
Bug description:ldap_connect sees correct args as *uninitialized*
Description:
------------
Calls to ldap_connect with present and correct arguments randomly
returns 'False'. Same code run again, even in the same debug session,
succeeds.
Single stepping with xdebug, examining the variables each step, shows no
differences in any variable whether the bind call then fails or works.
When it does fail, the debug log shows:
2016/04/20 07:36:49 [error] 4429#4429: *30 FastCGI sent in stderr: "PHP
message: PHP Warning: ldap_bind(): Unable to bind to server: Can't
contact LDAP server in /var/www/fusionpbx/foo.php on line 18
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /var/www/fusionpbx/foo.php:0
PHP message: PHP 2. ldap_bind(*uninitialized*, *uninitialized*,
*uninitialized*) /var/www/fusionpbx/foo.php:18" while reading response
header from upstream, client: 192.168.29.16, server: pbx, request: "GET
/foo.php?XDEBUG_SESSION_START=netbeans-xdebug HTTP/1.1", upstream:
"fastcgi://unix:/var/run/php5-fpm.sock:", host: "pbx1.foo.com"
Note: the 'ldaps'. This implementation requires the server to send the
caller a valid certificate, but also requires the caller to send the
server a valid certificate.
dpkg -l | egrep 'ldap|php|ssl|tls' | grep -vi codec
ii ldap-utils 2.4.42+dfsg-2ubuntu3
amd64 OpenLDAP utilities
ii libcurl3-gnutls:amd64 7.47.0-1ubuntu2
amd64 easy-to-use client-side URL transfer library (GnuTLS
flavour)
ii libgnutls-deb0-28:amd64 3.3.20-1ubuntu1
amd64 GNU TLS library - main runtime library
ii libgnutls-openssl27:amd64 3.4.10-4ubuntu1
amd64 GNU TLS library - OpenSSL wrapper
ii libgnutls30:amd64 3.4.10-4ubuntu1
amd64 GNU TLS library - main runtime library
ii libldap-2.4-2:amd64 2.4.42+dfsg-2ubuntu3
amd64 OpenLDAP libraries
ii libssl1.0.0:amd64 1.0.2g-1ubuntu4
amd64 Secure Sockets Layer toolkit - shared libraries
ii libssl1.0.2:amd64 1.0.2g-1+deb.sury.org~wily+1
amd64 Secure Sockets Layer toolkit - shared libraries
ii openssl 1.0.2g-1+deb.sury.org~wily+1
amd64 Secure Sockets Layer toolkit - cryptographic utility
ii php-cli 1:7.0+35ubuntu6
all command-line interpreter for the PHP scripting language
(default)
ii php-common 1:35ubuntu6
all Common files for PHP packages
ii php-pear 1:1.10.1+submodules+notgz-6
all PEAR Base System
ii php-xml 1:7.0+35ubuntu6
all DOM, SimpleXML, WDDX, XML, and XSL module for PHP
[default]
ii php5-cli 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 command-line interpreter for the php5 scripting language
ii php5-common 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 Common files for packages built from the php5 source
ii php5-curl 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 CURL module for php5
ii php5-fpm 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 server-side, HTML-embedded scripting language (FPM-CGI
binary)
ii php5-gd 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 GD module for php5
ii php5-imap 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 IMAP module for php5
ii php5-json 1.3.9-1+deb.sury.org~wily+4
amd64 JSON module for php5
ii php5-ldap 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 LDAP module for php5
ii php5-mcrypt 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 MCrypt module for php5
ii php5-memcache 3.0.8-5build1
amd64 memcache extension module for PHP5
ii php5-mysql 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 MySQL module for php5
ii php5-odbc 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 ODBC module for php5
ii php5-readline 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 Readline module for php5
ii php5-sqlite 5.6.20+dfsg-1+deb.sury.org~wily+1
amd64 SQLite module for php5
ii php5-xdebug 2.3.3-3+deb.sury.org~wily+1
amd64 Xdebug Module for PHP 5
rc php5.6-phpdbg 5.6.17+dfsg-5
amd64 server-side, HTML-embedded scripting language (PHPDBG
binary)
uname -a
Linux pbx1.foo.com 4.4.0-18-generic #34-Ubuntu SMP Wed Apr 6 14:01:02
UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Test script:
---------------
<?php
$tls_cert="/etc/ldap/certs/pbx.client.rsa.midterm.pem";
$tls_key ="/etc/ldap/certs/pbx.client.rsa.midterm.key.pkcs8.pem";
#putenv("LDAPTLS_CACERT=$tls_cacert");
putenv("LDAPTLS_CERT=$tls_cert");
putenv("LDAPTLS_KEY=$tls_key");
$c=ldap_connect('ldaps://directory.foo.com');
var_dump($c);
if (ldap_set_option($c, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo "Using LDAPv3\n";
} else {
echo "Failed to set protocol version to 3\n";
}
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
$d=ldap_bind($c,'cn=Harry Coin,ou=people,dc=foo,dc=com','bar');
var_dump($d);
exit;
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=72064&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72064&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72064&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72064&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72064&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72064&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72064&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72064&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72064&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72064&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72064&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72064&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72064&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72064&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72064&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72064&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72064&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72064&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72064&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72064&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72064&r=mysqlcfg