|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25764 php segfault when calling ldap_get_option on an unbinded ldap session
Submitted: 2003-10-06 14:46 UTC Modified: 2003-10-06 19:31 UTC
From: jpbarrette at savoirfairelinux dot net Assigned:
Status: Closed Package: LDAP related
PHP Version: 4CVS, 5CVS OS: linux
Private report: No CVE-ID: None
 [2003-10-06 14:46 UTC] jpbarrette at savoirfairelinux dot net
when I'm trying to get the  LDAP_OPT_ERROR_STRING option, 
by the ldap_get_option function, after the ldap_bind function 
faillure, php is segfaulting. 

Reproduce code:
$host = "localhost";
$user = "";
$passwd = "";

$connection = @ldap_connect($this->host, $this->port);
  die("unable to connect");
if(!@ldap_bind($connection, $user, $passwd)){
  echo ldap_error($connection);
  $error  = "";
  echo ldap_get_option($connection, LDAP_OPT_ERROR_STRING, $error);

Expected result:
I'm expecting to get the LDAP_OPT_ERROR_STRING value 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-06 16:25 UTC] jpbarrette at savoirfairelinux dot net
this is the backtrace but of the 4.3.4RC1 version. (so the problem 
is in the 4.3.4RC1 version too) 
#0  0x40260883 in strlen () from /lib/i686/ 
#1  0x0807e5d2 in zif_ldap_get_option (ht=136439660, 
return_value=0x2, this_ptr=0x0, return_value_used=0) 
    at /home/jpbarrette/tmp/php-4.3.4RC1/ext/ldap/ldap.c:1621 
#2  0x0817c3df in execute (op_array=0x821e76c) at 
#3  0x0816c785 in zend_execute_scripts (type=8, retval=0x0, 
    at /home/jpbarrette/tmp/php-4.3.4RC1/Zend/zend.c:885 
#4  0x0813bc43 in php_execute_script (primary_file=0xbffff240) 
at /home/jpbarrette/tmp/php-4.3.4RC1/main/main.c:1723 
#5  0x081820aa in main (argc=2, argv=0xbffff2d4) at 
#6  0x401fdc57 in __libc_start_main () from /lib/i686/
 [2003-10-06 19:31 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 17:01:32 2024 UTC