php.net |  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
Votes:14
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: niklas at eventusmedia dot fi
New email:
PHP Version: OS:

 

 [2010-05-27 15:56 UTC] niklas at eventusmedia dot fi
Description:
------------
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:
---------------
CREATE PROCEDURE MySP
BEGIN
  RAISERROR('Error happened', 18, 1)
END

<?php
$conn = mssql_connect(...);
mssql_min_error_severity(10);

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

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

Actual result:
--------------
That would output "OK!".

Patches

Pull Requests

History

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] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-10-15 23:15 UTC] kalle@php.net
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-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 05:01:28 2025 UTC