From:             roberto dot valsania at mail dot wind dot it
Operating system: FEDORA CORE 7 
PHP version:      5CVS-2007-09-12 (snap)
PHP Bug Type:     Sybase (dblib) related
Bug description:  PHP sybase_conect Crash when compiled with –with-sybase and 
–with-ldap and syba

Description:
------------
PHP sybase_conect Crash when compiled with –with-sybase and –with-ldap and
sybase name resolution is done via LDAP

If PHP is compiled without ldap extension all works. 
If Sybase resolution is done via interface file and not via LDAP all
works

To reproduce :

1)      Compile php with :
./configure --enable-debug
--with-sybase=/sbrdbms/sybase/OpenClient15/OCS-15_0/ --with-ldap  

Enable ldap sybase resolution by uncomment the following line in
$SYBASE/$SYBASE_OCS/config/libctl.cfg
ldap=libdldap.so ldap://ldaphost/dc=sybase,dc=com 

Please note that in this example the ldap server is only the default
example. In this situation the sybase_connect should return error instead
of a stack trace

2)      Run the following simple php script
<?php

$my_server='DBA_SUN_TEST' ;
$passwd='xxxxxx';
$login='sa';


$db=sybase_connect($my_server,$login, $passwd) ;
sybase_close($db);

?>





Reproduce code:
---------------
To reproduce :

1)      Compile php with :
./configure --enable-debug
--with-sybase=/sbrdbms/sybase/OpenClient15/OCS-15_0/ --with-ldap  

Enable ldap sybase resolution by uncomment the following line in
$SYBASE/$SYBASE_OCS/config/libctl.cfg
ldap=libdldap.so ldap://ldaphost/dc=sybase,dc=com 

Please note that in this example the ldap server is only the default
example. In this situation the sybase_connect should return error (because
it don't find the ldap server correct configuration) instead of a stack
trace

2)      Run the following simple php script
<?php

$my_server='DBA_SUN_TEST' ;
$passwd='xxxxxx';
$login='sa';


$db=sybase_connect($my_server,$login, $passwd) ;
sybase_close($db);

?>

Expected result:
----------------
an error or a sucessfull connection

Actual result:
--------------
A segmentation fault .
Here the backtrace :

[EMAIL PROTECTED] php5.2-200709120830]# gdb sapi/cli/php
GNU gdb Red Hat Linux (6.6-15.fc7rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
warning: not using untrusted file
"/root/Development/php5.2-200709120830/.gdbinit"
(gdb) run ../../TEST_PHP/test_sybase.php
Starting program: /root/Development/php5.2-200709120830/sapi/cli/php
../../TEST_PHP/test_sybase.php
[Thread debugging using libthread_db enabled]
[New Thread -1208449344 (LWP 23841)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208449344 (LWP 23841)]
0x00472dc2 in ldap_send_server_request () from /usr/lib/libldap-2.3.so.0
(gdb) bt
#0  0x00472dc2 in ldap_send_server_request () from
/usr/lib/libldap-2.3.so.0
#1  0x00473092 in ldap_send_initial_request () from
/usr/lib/libldap-2.3.so.0
#2  0x00468248 in ldap_sasl_bind () from /usr/lib/libldap-2.3.so.0
#3  0x0066bc75 in ldap_simple_bind ()
   from /sbrdbms/sybase/OpenClient15/OCS-15_0/lib3p/libsybaseldap.so
#4  0x00267473 in gdd_bind ()
   from /sbrdbms/sybase/OpenClient15/OCS-15_0//lib/libsybdldap.so.15.0.3
#5  0x00153f5d in drv_bind ()
   from /sbrdbms/sybase/OpenClient15/OCS-15_0//lib/libsybdb.so
#6  0x00153ab3 in dcl___bind ()
   from /sbrdbms/sybase/OpenClient15/OCS-15_0//lib/libsybdb.so
#7  0x00153b7a in dcl__bind_sync ()
   from /sbrdbms/sybase/OpenClient15/OCS-15_0//lib/libsybdb.so
#8  0x0015a11f in dcl_sess_bind ()
   from /sbrdbms/sybase/OpenClient15/OCS-15_0//lib/libsybdb.so
#9  0x00145663 in db__initnet ()
   from /sbrdbms/sybase/OpenClient15/OCS-15_0//lib/libsybdb.so
#10 0x0013077b in dbopen ()
   from /sbrdbms/sybase/OpenClient15/OCS-15_0//lib/libsybdb.so
#11 0x082ac4e4 in php_sybase_do_connect (ht=3, return_value=0xa2c6ed8,
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1,
persistent=0)
    at
/root/Development/php5.2-200709120830/ext/sybase/php_sybase_db.c:520
#12 0x082ac73f in zif_sybase_connect (ht=3, return_value=0xa2c6ed8,
---Type <return> to continue, or q <return> to quit---
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at
/root/Development/php5.2-200709120830/ext/sybase/php_sybase_db.c:571
#13 0x08338f4c in zend_do_fcall_common_helper_SPEC
(execute_data=0xbff1e474)
    at /root/Development/php5.2-200709120830/Zend/zend_vm_execute.h:200
#14 0x0833e81d in ZEND_DO_FCALL_SPEC_CONST_HANDLER
(execute_data=0xbff1e474)
    at /root/Development/php5.2-200709120830/Zend/zend_vm_execute.h:1681
#15 0x08338aad in execute (op_array=0xa2c60b8)
    at /root/Development/php5.2-200709120830/Zend/zend_vm_execute.h:92
#16 0x08313d1b in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /root/Development/php5.2-200709120830/Zend/zend.c:1134
#17 0x082c2773 in php_execute_script (primary_file=0xbff20810)
    at /root/Development/php5.2-200709120830/main/main.c:1983
#18 0x0838db78 in main (argc=2, argv=0xbff20964)
    at /root/Development/php5.2-200709120830/sapi/cli/php_cli.c:1140
(gdb)




-- 
Edit bug report at http://bugs.php.net/?id=42642&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42642&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42642&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42642&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42642&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42642&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42642&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42642&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42642&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42642&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42642&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42642&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42642&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42642&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42642&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42642&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42642&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42642&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42642&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42642&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42642&r=mysqlcfg

Reply via email to