From: netvbonline at yahoo dot co dot uk
Operating system: Win XP Pro
PHP version: 5.1.2
PHP Bug Type: MSSQL related
Bug description: mssql_execute with non fatal errors
Description:
------------
Using the extension php_mssql.dll and mssql_execute method to execute a
stored procedure within SQL Server 2000.
Basically, if the stored procedure generates a non-fatal message, for
example trying to insert a duplicate value into a table before doing a big
seek then output parameters are still available to Query analyser.
However when using the mssql_execute method, the execution fails.. even
though stored procedure is returning a successful execution value of 0.
Its possible to have a stored procedure with 10 statements, and 5
legitamately may fail with a non fatal message, which is handled
internally by the stored procedure.
The mssql_execute method should fail on execution (any in anycase should
still have populated output parameters).
Cheers.
Reproduce code:
---------------
$hStmt = mssql_init("usp_fetch_or_insert_forename", $hCon);
mssql_bind($hStmt, "@Forename", $name, SQLVARCHAR);
// Output
mssql_bind($hStmt, "@ForenameID", $ForenameID, SQLINT4, TRUE);
$result=mssql_execute($hStmt,true);
if (!$result) {
echo "ERROR HAS OCCURRED";
} else {
echo "NO ERROR";
}
if ($ForenameID==0) {
// error must have occurred
echo "There was an error trying to get forename pk and forenameid is
".$ForenameID;
} else {
echo "everything is fine and forenameid is ".$ForenameID;
}
Expected result:
----------------
$ForenameID=Value Returned From Stored Procedure
Actual result:
--------------
$ForenameID=0
--
Edit bug report at http://bugs.php.net/?id=37209&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37209&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=37209&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37209&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37209&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37209&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37209&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37209&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37209&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37209&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37209&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37209&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37209&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37209&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37209&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37209&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37209&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37209&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37209&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37209&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37209&r=mysqlcfg