#33153 [Asn]: segfaults when calling mssql_next_result

From: Date: Mon, 17 Oct 2005 19:56:57 +0000
Subject: #33153 [Asn]: segfaults when calling mssql_next_result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86665@lists.php.net to get a copy of this message
ID: 33153 User updated by: erudd at netfor dot com Reported By: erudd at netfor dot com Status: Assigned Bug Type: MSSQL related Operating System: FC3/FC4/MDK 10.2 x86 & x86_64 PHP Version: 4.3.11 Assigned To: fmk New Comment: Patch based on PHP_5_0 head branch applies to php 5.0.4 and php 4.3.10. tested and works with every I could throw at it (32 bit and 64 bit) Index: php_mssql.c =================================================================== RCS file: /repository/php-src/ext/mssql/php_mssql.c,v retrieving revision 1.137.2.9 diff -u -r1.137.2.9 php_mssql.c --- php_mssql.c 12 Apr 2005 17:46:06 -0000 1.137.2.9 +++ php_mssql.c 14 Oct 2005 23:02:42 -0000 @@ -1829,10 +1829,15 @@ WRONG_PARAM_COUNT; } ZEND_FETCH_RESOURCE(result, mssql_result *, mssql_result_index, -1, "MS SQL-result", le_result); mssql_ptr = result->mssql_ptr; retvalue = dbresults(mssql_ptr->link); + + while (dbnumcols(mssql_ptr->link) <= 0 && retvalue == SUCCEED) { + retvalue = dbresults(mssql_ptr->link); + } + if (retvalue == FAIL) { RETURN_FALSE; } Previous Comments: ------------------------------------------------------------------------ [2005-08-09 16:17:35] freddyz77 at tin dot it Problem here is that in mssql_next_result PHP do not ignore recordset without columns in mssql_query /* Skip results not returning any columns */ while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retvalue == SUCCEED) { retvalue = dbresults(mssql_ptr->link); } in mssql_execute /* Skip results not returning any columns */ while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retval_results == SUCCEED) { retval_results = dbresults(mssql_ptr->link); } but there is no such loop in mssql_next_result freddy77 ------------------------------------------------------------------------ [2005-08-03 18:56:54] erudd at netfor dot com Any updates on this issue? (Mandrake Bug #) http://qa.mandriva.com/show_bug.cgi?id=17272 ------------------------------------------------------------------------ [2005-06-28 18:54:00] erudd at netfor dot com I have tried the latest CVS code for the php-mssql extension and the same results occur.. I updated to the lastest on the 0.63 branch of freetds and apache/php no longer segfault, but PHP never advances to the next result set. ------------------------------------------------------------------------ [2005-05-30 10:31:51] freddyz77 at tin dot it dblastrow should not fail, this is certainly a FreeTDS bug. Fixed in CVS, expect a new 0.63.1 release. However I don't understand why PHP calls dblastrow (related to dblib buffering). freddy77 (FreeTDS developer) ------------------------------------------------------------------------ [2005-05-26 19:37:46] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/33153 -- Edit this bug report at http://bugs.php.net/?id=33153&edit=1

« previous php.bugs (#86665) next »