|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-12-16 22:50 UTC] fmk@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 01:00:02 2025 UTC |
Description: ------------ As of PHP 5.0.3 calling a SQL Server stored procedure that returns no result set incorrectly returns FALSE (to indicate an error condition) when it should return TRUE. I believe the problem was introduced with patch 1.137.2.3 to ext/mssql/php_mssql.c with this change: @@ -1184,6 +1196,9 @@ PHP_FUNCTION(mssql_query) while ((num_fields = dbnumcols(mssql_ptr->link)) <= 0 && retvalue == SUCCEED) { retvalue = dbresults(mssql_ptr->link); } + if (retvalue != SUCCEED) { + RETURN_FALSE; + } if ((num_fields = dbnumcols(mssql_ptr->link)) <= 0) { RETURN_TRUE; } In the case of a stored procedure that returns no result set retvalue == NO_MORE_RESULTS. This change now equates NO_MORE_RESULTS with a FALSE result, but that is incorrect. It should return TRUE as it does in PHP 5.0.2 to indicate a successful execution. Reproduce code: --------------- - Create an empty stored procedure. - Reproduce code: <?php $link = mssql_connect("localhost", "sa", "<<password>>"); mssql_select_db("<<database>>", $link); echo mssql_query("EXEC <<storedproc>>") ? "true" : "false"; mssql_close($link); ?> Expected result: ---------------- true Actual result: -------------- false