|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25817 Procedures returning recordset&variables spoiled
Submitted: 2003-10-10 04:24 UTC Modified: 2003-11-17 15:55 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: fjortiz at comunet dot es Assigned: fmk (profile)
Status: Closed Package: MSSQL related
PHP Version: 4.3.4RC2-dev OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
37 - 31 = ?
Subscribe to this entry?

 [2003-10-10 04:24 UTC] fjortiz at comunet dot es
I helped create the mssql_execute function, and I see a bug has been introduced since 4.1.1 (last time I saw the code)

If you craft a stored procedure returning BOTH a recordset and output variables, you'll only get the recordset, not the output variables. This worked fine in 4.1.1

Here is the problem:

php_mssql.c, line 2110
if ((num_fields = dbnumcols(mssql_ptr->link)) > 0) {
  // then get recordset...
else { // get output variables
  _mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);

this is wrong. You can get both of them. This is it:

if ((num_fields = dbnumcols(mssql_ptr->link)) > 0) {
  // then get recordset...

// and ALWAYS get the output variables
_mssql_get_sp_result(mssql_ptr, statement TSRMLS_CC);

I recompiled 4.3.3 php_mssql.dll with this and it works as expected (and as it was back in 4.1.1)

BTW it's in 4.3.4rc1 too.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-17 15:55 UTC]
The code was changed to handle multiple results with or without a return value.

MS SQL Server will not make the return value available until all results have been fetched from the server.

I have changed the code so it checks after each batch fetched. This should fix your problem and the problem you would get if data is divided into smaler batches. 
 [2003-12-18 23:47 UTC] rkumar at bombay dot imrglobal dot com
Hi All,

     I had the same problem about recordset and output value both not getting returned. I have made the modifications to PHP_MSSQL.dll and compiled it successfully and incase anyone wants the binary just drop a mail and I will be glad to send you the compiled DLL file. The new DLL file has been tested in my application and will help all other fellow developers as they wont have to recompile the file again. This will be my small contribution to the Open Source World.

Rajesh Kumar
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jul 05 10:05:45 2022 UTC