Home » Database » DB » Bug #1363
mssql_fetch_array($result, MSSQL_ASSOC) fails
Details
| Submitted | 2004-05-07 13:52 UTC |
|---|---|
| From | adamh at densi dot com |
| Assigned | danielc |
| Status | Closed |
| Package | DB |
| PHP Version | 4.3.5 |
| OS | All |
| 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