PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB » Bug #1363

mssql_fetch_array($result, MSSQL_ASSOC) fails

Details

Submitted2004-05-07 13:52 UTC
Fromadamh at densi dot com
Assigneddanielc
StatusClosed
PackageDB
PHP Version4.3.5
OSAll
Roadmaps(Not assigned)

Comments

[2004-05-07 13:52 UTC] adamh at densi dot com

Description:
------------
In line ~174 of mssql.php -- fetchInto():

$ar = @mssql_fetch_array($result, MSSQL_ASSOC);
will *always* fail if using sybase_ct for mssql functions. mssql_fetch_array() when using sybase_ct only takes one argument, despite what the PHP documentation says; and MSSQL_ASSOC is undefined.

As a simple fix to PEAR's DB, this line can be changed to:
$ar = @mssql_fetch_assoc($result);

This will work in all cases.

Reproduce code:
---------------
<?php

print MSSQL_ASSOC . "\n";

?>

Expected result:
----------------
1

Actual result:
--------------
PHP Notice: Use of undefined constant MSSQL_ASSOC - assumed 'MSSQL_ASSOC' in /home/adam/t.php on line 3

Notice: Use of undefined constant MSSQL_ASSOC - assumed 'MSSQL_ASSOC' in /home/adam/t.php on line 3
MSSQL_ASSOC

(Obviously this isn't a bug in PEAR's DB package, but the workaround is available and simple.)

[2005-06-10 13:51 UTC] david dot coallier at gmail dot com

This now resolved in that latest commit:

http://cvs.php.net/co.php/pear/DB/DB/mssql.php?r=1.85