ID:               34515
 Comment by:       mark at tranchant dot plus dot com
 Reported By:      jaba at inbox dot lv
 Status:           Feedback
 Bug Type:         MySQLi related
 Operating System: Debian GNU/Linux
 PHP Version:      5.0.5
 New Comment:

I've just written a quick C program using the MySQL C API and can
confirm that mysql_fetch_fields() works fine. The problem does appear
to be with the PHP code. I'll keep looking.


Previous Comments:
------------------------------------------------------------------------

[2005-10-27 13:09:52] mark at tranchant dot plus dot com

Not easily, no. I'm not set up for external users. If it would really
help, I could try. I've done some more digging:

In ext/mysqli/mysqli.c, there is the following code:

line 653:
 if (fetchtype & MYSQLI_ASSOC) {
    fields = mysql_fetch_fields(result);
 }

line 677:
 if (fetchtype & MYSQLI_ASSOC) {
    if (fetchtype & MYSQLI_NUM) {
       ZVAL_ADDREF(res);
    }
    add_assoc_zval(return_value, fields[i].name, res);
 }

line 687:
 if (fetchtype & MYSQLI_ASSOC) {
    add_assoc_null(return_value, fields[i].name);
 }

If I change the fields[i].name argument to "hello", the offending
functions then work. I successfully used fetch_array with MYSQLI_BOTH,
and $array['hello'] referred to the last element in the fetched array.

It seems as though the call to mysql_fetch_fields (part of the MySQL
API) is failing, which is not being detected by the PHP code. More
soon...

------------------------------------------------------------------------

[2005-10-27 12:34:42] [EMAIL PROTECTED]

Is there any chance to get an account on this server?

------------------------------------------------------------------------

[2005-10-27 12:29:06] mark at tranchant dot plus dot com

Yeah, I was right. Latest CVS snapshot (php5-STABLE-200510270836) does
not fix the issue.

------------------------------------------------------------------------

[2005-10-27 12:05:40] mark at tranchant dot plus dot com

In fact, any function that tries to do the assoc thing fails:
fetch_object fails, as does fetch_array with a resulttype of
MYSQLI_ASSOC or MYSQLI_BOTH. fetch_array works when called with
MYSQLI_NUM.

I'm just compiling the latest CVS snapshot, although the diff 'twixt
5.05's ext/mysqli directory and the CVS one doesn't give me much
hope...

------------------------------------------------------------------------

[2005-10-27 11:15:40] mark at tranchant dot plus dot com

I have the same problem. System is self-compiled PHP-5.05 and binary
distribution of MySQL-5.0.13, running on self-compiled Apache 2.0.55 on
x86 Linux.

mysqli_fetch_row() works as advertised, but mysqli_fetch_assoc() fails
silently, both called procedurally or in OO style.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/34515

-- 
Edit this bug report at http://bugs.php.net/?id=34515&edit=1

Reply via email to