|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-07-02 13:28 UTC] uw@php.net
[2012-07-02 13:28 UTC] uw@php.net
-Status: Open
+Status: Not a bug
[2015-07-06 11:53 UTC] cweiske@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 19:00:02 2025 UTC |
Description: ------------ When using UTF8 in the database (mySQL 5.5.24-0ubuntu0.12.04.1), fields defined as a certain length aren't returned as the correct length by mysqli_fetch_field_direct. IOW, a char(32) field is shown as actually being 96 chars long because it's 32 * 3 (3 bytes per char instead of one). The older mysql_field_len correctly reports the length. Test script: --------------- // Assuming a single table with a single field 'test' defined as char(32) // and UTF-8 charset. $connection = = mysqli_connect ('localhost', 'user', 'password'); $query = "SELECT test FROM test_table LIMIT 1"; $result = mysqli_query ($connection, $query); $field_info = mysqli_fetch_field_direct ($result, 0); echo $field_info -> length; Actual result: -------------- Returns 96; should be 32.