|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51932 mssql_execute() returns TRUE even when RAISERROR() raises error in SP
Submitted: 2010-05-27 15:56 UTC Modified: 2016-10-15 23:15 UTC
Avg. Score:4.6 ± 0.6
Reproduced:11 of 12 (91.7%)
Same Version:7 (63.6%)
Same OS:4 (36.4%)
From: niklas at eventusmedia dot fi Assigned:
Status: Wont fix Package: MSSQL related
PHP Version: 5.2.13 OS: Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: niklas at eventusmedia dot fi
New email:
PHP Version: OS:


 [2010-05-27 15:56 UTC] niklas at eventusmedia dot fi
I think mssql_execute() should return FALSE (or throw an ErrorException) when RAISERROR() raises error with severity >= mssql_min_error_severity().

Now it returns TRUE if query is run with success, no matter if error is risen.

Test script:
  RAISERROR('Error happened', 18, 1)

$conn = mssql_connect(...);

$stmt = mssql_init('MySP', $conn);
if (($ret = mssql_execute($stmt)) == false)
  echo "Error!";
  echo "OK!";

Expected result:
I expect the script to output "Error!".

Actual result:
That would output "OK!".


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-29 22:58 UTC] nick dot rawlins at gmail dot com
I am experiencing this too, very urgent! causing me problems.
 [2016-10-15 23:15 UTC]
-Status: Open +Status: Wont fix
 [2016-10-15 23:15 UTC]
With MSSQL being removed from PHP as of PHP7.0, and ext/mssql not having a maintainer, I'm gonna close this report as a Won't fix, until maybe one day it will find a new maintainer.

Alternatively you can use sqlsrv from Microsoft if you are on Windows, or pdo_dblib if you are on Unix.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 16:01:24 2020 UTC