Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:5961 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20215 invoked by uid 1010); 1 Dec 2003 23:07:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 20181 invoked from network); 1 Dec 2003 23:07:57 -0000 Received: from unknown (HELO mail.kromann.info) (64.186.239.125) by pb1.pair.com with SMTP; 1 Dec 2003 23:07:57 -0000 Received: from Swwwing2000 (unknown [64.186.239.115]) by mail.kromann.info (Postfix) with SMTP id 468642AE70; Mon, 1 Dec 2003 15:25:26 -0800 (PST) To: Michael Sisolak Cc: X-Mailer: Swwwing 2000 Message-ID: <10703199986400000@9866357972520000.9866341568840000> MIME-Version: 1.0 Reply-To: "Frank M. Kromann" Date: Mon, 01 Dec 2003 15:06:39 -0800 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [FIX] Bug #25585: PHP crash if executed MSSQL-query with RAISERROR() call and error 515 From: frank@kromann.info ("Frank M. Kromann") Hi Michael, I'm running on Windows XP and using MSSQL server 7.0 and 2000 both with the latest service packs. PHP 4.3.5-dev (cli) (built: Nov 4 2003 16:23:54) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies ntwdblib is 2000.2.8.0 - Frank > Frank, > > Hummm... I am seeing the crash on my development machine. Using PHP > 4.3.4 recompiled with the most recent php_mssql.c (1.86.2.26) this code > fails for me exactly as descibed in the bug report when run with the > CLI under Windows 2000 Professional. I'm running SQL Server 2000 SP3 > with version 8.00.194 of ntwdblib.dll. What is your configuration? > > Michael > > --- "Frank M. Kromann" wrote: > > This does not fix the problem. > > > > mssql_query is designed to stop fetching for each result. Use > > mssql_next_result() to move the internal pointer to the nex result > > and > > process the data. > > > > I have tested the code provided with the bug report and it works as I > > expect (no crash). > > > > - Frank > > > > > I believe the problem here is in how mssql_query handles result > > sets > > > that have multiple results returned, but none with rows (such as in > > > this bug where there are multiple commands executed and multiple > > errors > > > returned). In the php_mssql.c for PHP 4.3.4 the block at line 1145 > > > reads: > > > > > > while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retvalue > > == > > > SUCCEED) { > > > retvalue = dbresults(mssql_ptr->link); > > > } > > > > > > According to Microsoft > > > > > (http://msdn.microsoft.com/library/en-us/dblibc/dbc_pdc04e_52sz.asp), > > > however: > > > > > > "You must call dbresults until it returns NO_MORE_RESULTS, or > > > any continued use of the DBPROCESS causes the DB-Library error > > > 10038 'Results Pending'." > > > > > > As this code in php_mssql.c currently stands it stops looping the > > empty > > > result sets too early becuase it's looking for SUCCEED instead of > > > NO_MORE_RESULTS. Changing this code to: > > > > > > while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retvalue > > != > > > NO_MORE_RESULTS) { > > > retvalue = dbresults(mssql_ptr->link); > > > } > > > > > > causes both SQL Server error messages generated by the sample query > > in > > > the bug report to be correctly displayed and eliminates the fault. > > > > > > Michael Sisolak > > > msisolak@yahoo.com > > > > > > > > > __________________________________ > > > Do you Yahoo!? > > > Free Pop-Up Blocker - Get it now > > > http://companion.yahoo.com/ > > > > > > -- > > > PHP Internals - PHP Runtime Development Mailing List > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > __________________________________ > Do you Yahoo!? > Free Pop-Up Blocker - Get it now > http://companion.yahoo.com/ >