|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17875 sizeof() reports double the elements for an mssql_fetch_array
Submitted: 2002-06-20 11:56 UTC Modified: 2002-06-20 12:30 UTC
From: cusaacb at squared dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: cusaacb at squared dot com
New email:
PHP Version: OS:


 [2002-06-20 11:56 UTC] cusaacb at squared dot com
// correct behavior
$arr = array();

$arr[0] = "One";
$arr[1] = "Two";
$arr[2] = "Three";

print "Normal:&nbsp&nbsp&nbsp";
print sizeof($arr) . "<BR><BR>";

//show bug

$rs = mssql_query("select '1' as one, '2' as two, '3' as three from tablename");

$sqlarr = mssql_fetch_array($rs);

print "Bug:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp";

//-----  HERES THE BUG
print sizeof($sqlarr) . "\n";

./configure  --prefix=/usr/local/php --with-sybase=/usr/local/freetds --with-pgsql=/usr/local/pgsql --with-apxs2=/usr/local/apache2/bin/apxs


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-20 12:07 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

"mssql_fetch_array() is an extended version of mssql_fetch_row(). In addition to storing the data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys."
 [2002-06-20 12:30 UTC] cusaacb at squared dot com
OK. I see.  If you want to just iterate over the fields you would use mssql_fetch_row() instead.

Sorry and Thanks,
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 20 06:03:37 2021 UTC