php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43832 mysqi_get_charset() doesn't expose charset comment
Submitted: 2008-01-13 21:11 UTC Modified: 2008-03-25 18:31 UTC
From: hartmut@php.net Assigned: andrey (profile)
Status: Closed Package: MySQLi related
PHP Version: 5.3CVS-2008-01-13 (CVS) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hartmut@php.net
New email:
PHP Version: OS:

 

 [2008-01-13 21:11 UTC] hartmut@php.net
Description:
------------
The mysql C API exposes a charset comment field (see http://dev.mysql.com/doc/refman/5.1/en/mysql-get-character-set-info.html) which exposes extra information on the character set.

The information is the same as in the "Description" result column returned by "SHOW CHARSET;"

IMHO the charset comment should be part of the mysqli_get_charset() result.

Adding this to "classic" ext/mysqli is easy but getting this into mysqlnd seems to be more tricky

Reproduce code:
---------------
<?php
$db = mysqli_init();
$db->real_connect("localhost", "root", "", "test");
var_dump($db->get_charset());
?>

Expected result:
----------------
object(stdClass)#2 (8) {
  ["charset"]=>
  string(6) "latin1"
  ["collation"]=>
  string(17) "latin1_swedish_ci"
  ["dir"]=>
  string(0) ""
  ["min_length"]=>
  int(1)
  ["max_length"]=>
  int(1)
  ["number"]=>
  int(8)
  ["state"]=>
  int(801)
  ["comment"]=>
  string(20) "cp1252 West European"
}


Actual result:
--------------
object(stdClass)#2 (8) {
  ["charset"]=>
  string(6) "latin1"
  ["collation"]=>
  string(17) "latin1_swedish_ci"
  ["dir"]=>
  string(0) ""
  ["min_length"]=>
  int(1)
  ["max_length"]=>
  int(1)
  ["number"]=>
  int(8)
  ["state"]=>
  int(801)
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-25 18:31 UTC] andrey@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed in 5.3-CVS
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Sep 20 13:00:01 2025 UTC