Bug #66070 [Opn->Csd]: UTF8 Keys Truncated at 15 When mbstring Installed

From: Date: Sat, 11 Apr 2015 17:15:58 +0000
Subject: Bug #66070 [Opn->Csd]: UTF8 Keys Truncated at 15 When mbstring Installed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191978@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66070&edit=1 ID: 66070 Updated by: cmb@php.net Reported by: ewilde at bsmdevelopment dot com Summary: UTF8 Keys Truncated at 15 When mbstring Installed -Status: Open +Status: Closed Type: Bug Package: ODBC related Operating System: CentOS 6.4 PHP Version: 5.5.5 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php The 32 byte limit has already been mitigated; the field name can have up to 256 bytes as of PHP 5.4.0. Unfortunately, there has been a temporary regression (at least PHP 5.5.3 and 5.5.4 have been affected), but since PHP 5.5.7 the limit is 256 bytes again. Previous Comments: ------------------------------------------------------------------------ [2013-11-09 03:45:52] ewilde at bsmdevelopment dot com Description: ------------ It is a well-known fact that ODBC support truncates returned database keys to 31 characters. No surprise there, since the key name length is hard coded at 32 bytes in php_odbc_includes.h. And, no complaints either, since we've all learned how to live with it. However, when "mbstring" support is compiled into PHP using "--enable-mbstring" at build time, the keys are now truncated at 15. This happens even when the server and database are set to a single-byte character set such as UTF8. In my case, I am using mysql-5.6.14, unixODBC-2.3.2 and mysql-connector-odbc-5.2.6-src. I have set "character-set-server = utf8" in my.cnf and have set the default database character set with "alter database character set = 'utf8';" but still no joy. The obvious fix is to recompile PHP with "char name[64];" in the odbc_result_value structure in php_odbc_includes.h. However, if it is possible, ODBC support should query the database and determine which character set is in use (e.g. the query in question under MySQL is "show variables like 'character_set_database';"). If it is an 8-byte character set, the mbstring support should be turned off and the full 31-byte keys returned. If it is not possible, I throw my vote behind changing the key length to 64 by default (regardless of the reluctance to do so as expressed in Bug #30043). ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66070&edit=1

« previous php.bugs (#191978) next »