ID: 26589 Updated by: [EMAIL PROTECTED] Reported By: justin22 at v-biz dot net -Status: Open +Status: Feedback Bug Type: MSSQL related Operating System: windows 2000 PHP Version: 4CVS, 5CVS New Comment:
Does it crash if you run it from command line using CLI / CGI binary? Previous Comments: ------------------------------------------------------------------------ [2003-12-14 20:28:51] justin22 at v-biz dot net I've created a sample database with my table, along with this script: <? echo "Connect to server<br>"; $ConnID = mssql_pconnect('justin', 'xxx', 'ppp'); if ($ConnID===false) die("Cannot connect to server"); echo "select Database<br>"; if (!mssql_select_db('PhpMoneyTest')) die('cannot select db PHPmoneytest'); $sql="select amount as amount from Test"; $result = mssql_query($sql); // php crashes here echo "Test Passed" // Finished ?> php.ini settings are: [MSSQL] ; Allow or prevent persistent links. mssql.allow_persistent = on ; Maximum number of persistent links. -1 means no limit. mssql.max_persistent = -1 ; Maximum number of links (persistent+non persistent). -1 means no limit. mssql.max_links = -1 ; Minimum error severity to display. mssql.min_error_severity = 10 ; Minimum message severity to display. mssql.min_message_severity = 10 ; Compatability mode with old versions of PHP 3.0. mssql.compatability_mode = Off ; Valid range 0 - 2147483647. Default = 4096. ;[jvp] allow more text! mssql.textlimit = 16384 ; Valid range 0 - 2147483647. Default = 4096. ;[jvp] mssql.textsize = 16384 ; Limits the number of records in each batch. 0 = all records in one batch. mssql.batchsize = 0 ; Use NT authentication when connecting to the server mssql.secure_connection = 0 ; Specify max number of processes. Default = 25 ;mssql.max_procs = 25 ; Disable date time conversions: dates formatted yyyy-mm-dd hh:mm:ssAA mssql.datetimeconvert = 0 I tried changing some of these (in particular, tried without persistent connections) without any effect. I'm using apache module, but this dies with only a single process (request), so its unlikely to be a thread issue. I'm very concerned about your threadsafe comments - can you point me to any discussion of this issue? sample db with table 'Test' emailed as requested. Thanks for your quick response! Justin ------------------------------------------------------------------------ [2003-12-12 01:02:00] [EMAIL PROTECTED] I've tested this with the latest code from CVS of both php4 and php5 and I can't reproduce it. Please provide some more details like php.ini settings for mssql and are you using CGI or apache module ? The Microsoft library used for the mssql extension is not thread safe. That could be the problem if you are using apache module. You can send your sample code and data to [EMAIL PROTECTED] ------------------------------------------------------------------------ [2003-12-11 21:41:47] justin22 at v-biz dot net Tried latest CVS, exact same result. Could be same problem as reported in bug #19588, as I tried to do a convert(smallmoney, amount) instead of float conversion and it still failed. ------------------------------------------------------------------------ [2003-12-11 06:34:32] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-12-10 22:02:24] justin22 at v-biz dot net Description: ------------ php 4.3.3 & 4.3.4 / sql server 2000 sp3 / win2k sp4 / apache 2.0.47 query contains a money field, after 30-40 rows, apache crashed. apache log: [Thu Dec 11 10:11:02 2003] [notice] Parent: child process exited with status 3221225477 -- Restarting. [Thu Dec 11 10:11:04 2003] [notice] Parent: Created child process 1008 dr watson log: Application exception occurred: App: (pid=1168) When: 11/12/2003 @ 10:11:00.979 Exception number: c0000005 (access violation) ... State Dump for Thread Id 0x544 eax=223d6504 ebx=000000e9 ecx=3e223335 edx=01ebb298 esi=01aa0000 edi=01ebab50 eip=77fcb032 esp=01a1da40 ebp=01a1dbd8 iopl=0 nv up ei pl zr na po nc cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246 function: _eFSQRT 77fcb00e 884705 mov [edi+0x5],al ds:02944a36=?? 77fcb011 ff75d0 push dword ptr [ebp+0xd0] ss:024a7abe=???????? 77fcb014 8b75a4 mov esi,[ebp+0xa4] ss:024a7abe=???????? 77fcb017 56 push esi 77fcb018 e81de5fbff call RtlConsoleMultiByteToUnicodeN+0x348 (77f8953a) 77fcb01d 8b4dd0 mov ecx,[ebp+0xd0] ss:024a7abe=???????? 77fcb020 8b4108 mov eax,[ecx+0x8] ds:3ecad21b=???????? 77fcb023 8985d8feffff mov [ebp+0xfffffed8],eax ss:01a1dab0=223d6504 77fcb029 8b490c mov ecx,[ecx+0xc] ds:3ecad21b=???????? 77fcb02c 898dd4feffff mov [ebp+0xfffffed4],ecx ss:01a1daac=3e223335 FAULT ->77fcb032 8901 mov [ecx],eax ds:3e223335=???????? 77fcb034 894804 mov [eax+0x4],ecx ds:22e603ea=???????? 77fcb037 3bc1 cmp eax,ecx 77fcb039 0f84b7240000 je RtlFreeHeap+0xd23 (77fcd4f6) 77fcb03f 8b45d0 mov eax,[ebp+0xd0] ss:024a7abe=???????? 77fcb042 0fb708 movzx ecx,word ptr [eax] ds:223d6504=???? 77fcb045 294e28 sub [esi+0x28],ecx ds:02529ee6=???????? 77fcb048 0fb700 movzx eax,word ptr [eax] ds:223d6504=???? 77fcb04b 03d8 add ebx,eax 77fcb04d 895da8 mov [ebp+0xa8],ebx ss:024a7abe=???????? 77fcb050 81fb00fe0000 cmp ebx,0xfe00 77fcb056 0f86d4240000 jbe RtlFreeHeap+0xd5d (77fcd530) *----> Stack Back Trace <----* FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name 01A1DBD8 00F4EEB2 01AA0000 00000001 000000B0 000000A0 ntdll!_eFSQRT 000000A0 00000000 00000000 00000000 00000000 00000000 !emalloc fault is 100% repeatable on a particular dataset. the problem goes away if I change the source query to convert to a float: select CONVERT(float, dbo.Payments.Amount) AS Amount Reproduce code: --------------- $sql="select amount from fred"; if (!db_connect()) return false; $result = mssql_query($sql); // Crash $sql="select CONVERT(float, dbo.Payments.Amount) AS Amount from fred" $result = mssql_query($sql); // OK Sample table Fred has 1 column, Amount(money) with 236 rows, can be supplied on request ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26589&edit=1