From: php at centaur dot mailshell dot com
Operating system: Windows XP SP1
PHP version: 4.3.1
PHP Bug Type: MSSQL related
Bug description: empty result sets returned incorrectly from mssql_execute
Windows XP SP1
MSSQL 2000
Apache 2.0.44
PHP 4.3.1
Procedure definition:
CREATE PROCEDURE foo
@filter VARCHAR(255)
AS
SELECT id FROM bar WHERE baz LIKE @filter
GO;
Script:
<?php
$con = mssql_connect('localhost', $user, $password);
mssql_select_db($dbname);
$sp = mssql_init('foo');
mssql_bind($sp, '@filter', $filter, SQLVARCHAR);
$result = mssql_execute($sp);
print "[".$result."]\n"; // point A
while ($row = mssql_fetch_object($result)) {
// do something with $row
}?>
If there are no records in bar that satisfy $filter, [1] is printed at
point A, and then mssql_fetch_object (and other functions that expect a
resource ID, e.g. mssql_next_result) fails.
--
Edit bug report at http://bugs.php.net/?id=22391&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22391&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22391&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22391&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22391&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22391&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22391&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22391&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22391&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22391&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22391&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22391&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22391&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22391&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22391&r=gnused