Doc #60333 [Fbk->Asn]: fetch_field() length multiplied by 3 in mysqlnd
| From: | danielc at analysisandsolutions dot com | Date: | Sat, 28 Jan 2012 01:09:45 +0000 |
| Subject: | Doc #60333 [Fbk->Asn]: fetch_field() length multiplied by 3 in mysqlnd | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-7881@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60333&edit=1
ID: 60333
User updated by: danielc at analysisandsolutions dot com
Reported by: danielc at analysisandsolutions dot com
Summary: fetch_field() length multiplied by 3 in mysqlnd
-Status: Feedback
+Status: Assigned
Type: Documentation Problem
Package: MySQLi related
Operating System: linux
PHP Version: 5.4SVN-2011-11-19 (SVN)
Assigned To: frozenfire
Block user comment: N
Private report: N
New Comment:
It happens with libmysql under certain circumstances too. I am working to get a straight answer out
of the Johannes and Ulf about a related issue and will post back when that becomes available.
Previous Comments:
------------------------------------------------------------------------
[2012-01-28 00:29:55] frozenfire@php.net
Does this issue only arise when using mysqlnd?
------------------------------------------------------------------------
[2012-01-23 20:59:51] johannes@php.net
The behavior is correct. We report the same data as we retrieve from the server. The MySQL
documentation has more details on this:
http://dev.mysql.com/doc/refman/5.5/en/c-api-data-structures.html
The key part here is that the data is returned in bytes. On a connection using UTF-8 these are 3
bytes per character.
The PHP documentation should be made more clear on this.
------------------------------------------------------------------------
[2012-01-13 18:09:05] danielc at analysisandsolutions dot com
Can this please be fixed before PHP 5.4 goes out the door?
------------------------------------------------------------------------
[2011-11-21 18:04:38] danielc at analysisandsolutions dot com
That may be the case, but having UTF-8 fields is legit and the answers from libmysql and mysqlnd
should be the same.
------------------------------------------------------------------------
[2011-11-21 17:59:23] william dot bailey at cowboysfromhell dot co dot uk
I think this might be down to what encoding the connection is using.
The length in bytes of a mysql utf8 CHAR(2) field is 6.
If you issue a $db->query('SET NAMES latin1'); before the CREATE TABLE then you
should get the results you are expecting.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=60333
--
Edit this bug report at https://bugs.php.net/bug.php?id=60333&edit=1