php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47072 php crash when mssql_connect to remote MSSQLSERVER 2005 Standart Edition
Submitted: 2009-01-12 10:04 UTC Modified: 2016-10-15 23:14 UTC
Votes:48
Avg. Score:4.4 ± 1.0
Reproduced:32 of 33 (97.0%)
Same Version:29 (90.6%)
Same OS:26 (81.2%)
From: bloodjazman at gmail dot com Assigned:
Status: Wont fix Package: MSSQL related
PHP Version: 5.2.8 OS: win32 only - Windows XP SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bloodjazman at gmail dot com
New email:
PHP Version: OS:

 

 [2009-01-12 10:04 UTC] bloodjazman at gmail dot com
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!_ChangeName@8()  + 0x2a bytes	
 	ntwdblib.dll!_PrintMessage@12()  + 0x2a5 bytes	
 	ntwdblib.dll!_HandleInfoToken@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)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-13 09:19 UTC] bloodjazman at gmail dot com
Problem solved when change Default Language = English in properties SQL Server Management Studio
 [2009-01-14 07:46 UTC] bloodjazman at gmail dot com
recomended check php.ini

mssql.allow_persistent = On 
mssql.compatability_mode = Off
mssql.min_error_severity = 10 
mssql.min_message_severity = 10
mssql.secure_connection = Off
 [2016-10-15 23:14 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-10-15 23:14 UTC] kalle@php.net
With MSSQL being removed from PHP as of PHP7.0, and ext/mssql not having a maintainer, I'm gonna close this report as a Won't fix, until maybe one day it will find a new maintainer.

Alternatively you can use sqlsrv from Microsoft if you are on Windows, or pdo_dblib if you are on Unix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 00:01:27 2024 UTC