#33153 [NEW]: segfaults when calling mssql_next_result
| From: | erudd at netfor dot com | Date: | Thu, 26 May 2005 16:16:45 +0000 |
| Subject: | #33153 [NEW]: segfaults when calling mssql_next_result | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-79562@lists.php.net to get a copy of this message | ||
From: erudd at netfor dot com
Operating system: Fedora Core 3 x86_64
PHP version: 4.3.11
PHP Bug Type: MSSQL related
Bug description: segfaults when calling mssql_next_result
Description:
------------
Using the mssql extension from PHP 4.3.11 on an x86_64 system. (core PHP
is latest FC3 RPMS, php-mssql is custom compiled RPM using freetds 0.63).
Everything works fine except for calling the mssql_next_result function
(via PEAR::DB 1.7.6) apache and the command line client will segfault.
This works fine on a MDK 10.1 32bit system w/ PHP 4.3.8.
I havn't yet tried on a FC3 x86 system
Also the freetds commandline 'tsql" command runs the query without any
issues and returns all the result fields.
Reproduce code:
---------------
require_once("DB.php");
$db =& DB::connect("mssql://user:pass@server/Database");
$sql = <<<EOSQL
DECLARE Search CURSOR LOCAL SCROLL READ_ONLY FOR
SELECT * FROM MyTable
DECLARE @limit INT, @offset INT
SET @limit = 20
SET @offset = 5
OPEN Search
FETCH ABSOLUTE @offset FROM Search
WHILE @@FETCH_STATUS =0 AND @limit > 1
BEGIN
FETCH NEXT FROM Search
SET @limit = @limit -1
END
CLOSE Search
DEALLOCATE Search
EOSQL;
$res =& $db->query($sql);
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC);
do {
$return[] =& $row;
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC);
if (is_null($row)) {
if ($res->nextResult()) {
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC);
}
}
} while ($row);
Expected result:
----------------
Not to segfault and return 20 records from the table starting at record 5
--
Edit bug report at http://bugs.php.net/?id=33153&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33153&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33153&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33153&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33153&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33153&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33153&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33153&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33153&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33153&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33153&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33153&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33153&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33153&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33153&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33153&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33153&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33153&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33153&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33153&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33153&r=mysqlcfg