From:             bloodjazman at gmail dot com
Operating system: Windows XP SP2
PHP version:      5.2.8
PHP Bug Type:     Reproducible crash
Bug description:  php crash when mssql_connect to remote MSSQLSERVER 2005 
Standart Edition

Description:
------------
i read all comments on
http://php.net/manual/en/function.mssql-connect.php

i have 
developers machine
Windows XP SP2 (5.1.2600)
+ php 5.2.8 (and reproduce under php-5.2-win32-VC6-x86-latest.zip,
php-5.3-win32-VC9-x86-latest.zip)

ntwdblib.dll 2000.80.194.0 (and reproduce under ntwdblib.dll 2000.2.8.0)

and remote machine Windows 2003 SP1 + MSSQLServer 2005 Standart Edition
(version 9.0.1339)

---------------------
php.ini
mssql.secure_connection=off

php.exe -i | grep mssql
>
mssql
mssql.allow_persistent => On => On
mssql.batchsize => 0 => 0
mssql.compatability_mode => Off => Off
mssql.connect_timeout => 5 => 5
mssql.datetimeconvert => On => On
mssql.max_links => 50 => 50
mssql.max_persistent => 10 => 10
mssql.max_procs => 25 => 25
mssql.min_error_severity => 0 => 0
mssql.min_message_severity => 1 => 1
mssql.secure_connection => Off => Off
mssql.textlimit => Server default => Server default
mssql.textsize => Server default => Server default
mssql.timeout => 60 => 60


when try running reproduction code (see below)
i have 

Unhandled exception at 0x7333f179 (ntwdblib.dll) in php.exe: 0xC0000005:
Access violation reading location 0x003effff.



Reproduce code:
---------------
<?
/**
 // this code working fine, but i'm need connect to remote MSSQL 2005
Standart Server (not Express)
  $mssql=mssql_connect('.\SQLEXPRESS','sa','sysdba') or die('Error MSSQL
Connect '.mssql_get_last_message());
  var_dump($mssql);
*/

  $mssql=mssql_connect('192.168.x.x','sa','sysdba') or die('Error MSSQL
Connect '.mssql_get_last_message());
  var_dump($mssql);
?>

Expected result:
----------------
resource(4) of type (mssql link)

Actual result:
--------------
crash php.exe
with debug backtrace

>       ntwdblib.dll!_changen...@8()  + 0x2a bytes      
        ntwdblib.dll!_printmess...@12()  + 0x2a5 bytes  
        ntwdblib.dll!_handleinfoto...@8()  + 0x112 bytes        
        ntwdblib.dll!_dbresults()  + 0x341 bytes        
        ntwdblib.dll!_dbopen()  + 0xdfe bytes   
        php_mssql.dll!php_mssql_do_connect(int ht=17745128, _zval_struct *
return_value=0x010ec4d0, _zval_struct * * return_value_ptr=0x00000000,
_zval_struct * this_ptr=0x00000000, int return_value_used=1, void * * *
tsrm_ls=0x00222450, int persistent=0)  Line 661 + 0xb bytes     C
        php_mssql.dll!zif_mssql_connect(int ht=3, _zval_struct *
return_value=0x010ec4d0, _zval_struct * * return_value_ptr=0x00000000,
_zval_struct * this_ptr=0x00000000, int return_value_used=1, void * * *
tsrm_ls=0x00222450)  Line 724 + 0x25 bytes      C
        php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data=0x00c0fbd0, void * * * tsrm_ls=0x00222450)  Line 200 + 0x3d
bytes   C
        php5ts.dll!ZEND_DO_FCALL_SPEC_CONST_HANDLER(_zend_execute_data *
execute_data=0x00000000, void * * * tsrm_ls=0x00222450)  Line 1729 + 0xe
bytes   C
        php5ts.dll!execute(_zend_op_array * op_array=0x00000008, void * * *
tsrm_ls=0x00222450)  Line 92 + 0xc bytes        C
        php5ts.dll!php_execute_script(_zend_file_handle *
primary_file=0x00c0fec8, void * * * tsrm_ls=0x00222450)  Line 2023 + 0x12
bytes   C
        php.exe!main(int argc=5, char * * argv=0x00223f70)  Line 1134   C
        php.exe!_mainCRTStartup()  + 0xe3 bytes 
        kernel32.dll!7c816d4f()         

----------------------------------------------
when i change settings php.ini 
mssql.secure_connection = On

i have other errors when php_mssql.dll try using NT Authorization

Warning: mssql_connect(): message: Login failed for user 'westltp'. The
user is not associated with a trusted SQL Server connection. (Microsoft SQL
Server, error: 18452) (severity 14) in
C:\usr\local\apache\htdocs\test\mssql_connect.php on line 6

Warning: mssql_connect(): Login incorrect. (severity 2) in
C:\usr\local\apache\htdocs\test\mssql_connect.php on line 6

Warning: mssql_connect(): Unable to connect to server:  192.168.x.x in
C:\usr\local\apache\htdocs\test\mssql_connect.p
hp on line 6
Error MSSQL Connect Login failed for user 'westltp'. The user is not
associated with a trusted SQL Server connection. (Microsoft SQL Server,
error: 18452)


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

Reply via email to