#51163 [Opn->Asn]: fetch_field variants manual is wrong - they dont provide default value def
| From: | abedford@php.net | Date: | Mon, 01 Mar 2010 15:25:22 +0000 |
| Subject: | #51163 [Opn->Asn]: fetch_field variants manual is wrong - they dont provide default value def | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3996@lists.php.net to get a copy of this message | ||
ID: 51163
Updated by: abedford@php.net
Reported By: berniev at bje dot com dot au
-Status: Open
+Status: Assigned
Bug Type: Documentation problem
Operating System: ubuntu 9
PHP Version: 5.3.1
-Assigned To:
+Assigned To: abedford
Previous Comments:
------------------------------------------------------------------------
[2010-03-01 15:07:33] berniev at bje dot com dot au
You are correct in that fetch_field doesn't crash but it always
produces empty default column data.
Googling shows this is a common problem. Workaround is to use mysql
SHOW COLUMNS FROM .. but this is an extra step.
shoresofnowhere at gmail dot com 26-Aug-2009 10:50 in
http://au2.php.net/mysqli-result.fetch-field-direct
suggests it will
never produce a result by design and gives what appears a reasonable
explanation.
I tried examining sources but am not clever enough yet to figure it
out. Maybe someone can point me in the right direction.
For the benefit of all us noobs please clarify if this is a bug or
design.
In any event it appears to have been like this for a while and I think
this should be reflected in the documentation. Seems to be quite a few
of us wasting a lot of time looking for explanation.
------------------------------------------------------------------------
[2010-02-27 23:29:40] niel dot archer at blueyonder dot co dot uk
This appears to be a bug, not a documentation problem. I just tried
this on PHP 5.3 using the MySQLi extension.
$finfo = $result->fetch_field();
echo $finfo->def;
Prints an empty string, it does not produce an error for an invalid
property.
------------------------------------------------------------------------
[2010-02-27 04:55:19] berniev at bje dot com dot au
Description:
------------
The manuals for PHP all show mysql_fetch_field (s) (and mysqli) provide
the table default value, WHICH THEY DO NOT!
The manuals appear to be blatantly wrong.
Interestingly the examples conveniently leave out def values.
This may also apply to autoinc and primary key flags?
The only reference to this I could find anywhere is a note from
shoresofnowhere at gmail dot com 26-Aug-2009 10:50 after hours of
searching.
Please Please update the manuals!! (or fix php !)
Reproduce code:
---------------
---
From manual page: http://www.php.net/mysqli-result.fetch-field-direct
---
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=51163&edit=1