ID: 49961 Updated by: u...@php.net Reported By: aavolkoff at gmail dot com Status: Open Bug Type: MySQLi related Operating System: Linux l9.in-solve.ru 2.6.26-r9-s PHP Version: 5.2.11 New Comment:
Sounds bogus. The mysql extensions in 5.2 forward 1 by 1 what the C API = Mysql returns. The multiplier of 3 hints that a 3-byte charset gets used in one case and a 1-byte charset in the other Without information on the character sets used, this cannot be verified. You need to provide character set information Previous Comments: ------------------------------------------------------------------------ [2009-10-22 18:02:12] aavolkoff at gmail dot com Description: ------------ Value of "length" column for fetch_fields() is incorrect. eg: MySQL version: 5.0.37 Reproduce code: --------------- I have table "Users": name = "id"; type = "INT"; length = 11. name = "name"; type = "VARCHAR"; length = 200. name = "description"; type = "VARCHAR"; length = 200. Code: //$mysqli defined earlier $query = "SELECT * FROM `Users` LIMIT 0"; $query_result = $mysqli->real_query($query); if ($query_result) { $mysqli_result = $mysqli->use_result(); $mysqli_fields = $mysqli_result->fetch_fields(); $mysqli_result->free_result(); print_r($mysqli_fields); } Expected result: ---------------- Array ( [0] => stdClass Object ( [name] => id [orgname] => id [table] => Users [orgtable] => Users [def] => [max_length] => 0 [length] => 11 [charsetnr] => 63 [flags] => 49667 [type] => 3 [decimals] => 0 ) [1] => stdClass Object ( [name] => name [orgname] => name [table] => Users [orgtable] => Users [def] => [max_length] => 0 [length] => 200 [charsetnr] => 33 [flags] => 0 [type] => 253 [decimals] => 0 ) [2] => stdClass Object ( [name] => description [orgname] => description [table] => Users [orgtable] => Users [def] => [max_length] => 0 [length] => 200 [charsetnr] => 33 [flags] => 0 [type] => 253 [decimals] => 0 ) ) Actual result: -------------- Array ( [0] => stdClass Object ( [name] => id [orgname] => id [table] => Users [orgtable] => Users [def] => [max_length] => 0 [length] => 11 [charsetnr] => 63 [flags] => 49667 [type] => 3 [decimals] => 0 ) [1] => stdClass Object ( [name] => name [orgname] => name [table] => Users [orgtable] => Users [def] => [max_length] => 0 [length] => 600 [charsetnr] => 33 [flags] => 0 [type] => 253 [decimals] => 0 ) [2] => stdClass Object ( [name] => description [orgname] => description [table] => Users [orgtable] => Users [def] => [max_length] => 0 [length] => 600 [charsetnr] => 33 [flags] => 0 [type] => 253 [decimals] => 0 ) ) Parameter "length" of array elements is incorrect (600, but not 200). When I change length in PhpMyAdmin to 150 code "says" that length is 450. When I change length in PhpMyAdmin to 1 code "says" that length is 3. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49961&edit=1