ID:               49961
 Updated by:       u...@php.net
 Reported By:      aavolkoff at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQLi related
 Operating System: Linux l9.in-solve.ru 2.6.26-r9-s
 PHP Version:      5.2.11
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

What is needed is all the character sets: MySQL server, client etc.


Previous Comments:
------------------------------------------------------------------------

[2009-10-23 07:17:16] u...@php.net

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

------------------------------------------------------------------------

[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

Reply via email to