php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #61053 mysql_fetch_field should return type = "enum" and enum options
Submitted: 2012-02-11 01:49 UTC Modified: 2012-02-11 11:12 UTC
From: zzatkin at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.3.10 OS: Linux
Private report: No CVE-ID: None
 [2012-02-11 01:49 UTC] zzatkin at gmail dot com
Description:
------------
mysql_fetch_field returns type = "string" for enum fields in the MySQL database, 
but should instead return "enum" and an array of possible values for convenience.

Test script:
---------------
<?php
$connect = mysql_connect('localhost','user','password');
mysql_select_db('some_database',$connect);
$query = mysql_query('SELECT * FROM table');
var_dump(mysql_fetch_field($query,1));
?>

Expected result:
----------------
array(12) {
...
["type"]=>
string(6) "string"
...
}

Actual result:
--------------
array(12) {
...
["type"]=>
array(3) {
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
...
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-11 11:12 UTC] johannes@php.net
-Status: Open +Status: Not a bug
 [2012-02-11 11:12 UTC] johannes@php.net
We report the information we get from the MySQL serer. To change this the MySQL Server has to report a different type. Report there.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 14:01:31 2024 UTC