php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48928 collation discreapency between mysql.exe client and mysql extensions.
Submitted: 2009-07-15 16:37 UTC Modified: 2009-07-15 16:38 UTC
From: serge dot laot at wanadoo dot fr Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.10 OS: Win XP Pro, Win server 2003
Private report: No CVE-ID: None
 [2009-07-15 16:37 UTC] serge dot laot at wanadoo dot fr
Description:
------------
php_mysql.dll (or php_mysqli.dll) extension do not use the same configuration as MySQL.exe, so if you run the same query from both sides you will not get the same results.

I know I can use the following :

@@mysql_query("SET NAMES 'utf8'",$my);

on a fresh connection, but if the MySQL configuration changes I must have to change the php code as well.

Reproduce code:
---------------
PHP code :
$rec=@@mysql_query("show Variables LIKE 'c___a%_%'",$my);
while($row=mysql_fetch_assoc($rec)){
    foreach($row as $n=>$v){
        echo $v."\n";
    }
}

MySQL code ;
show Variables LIKE 'c___a%_%';

Expected result:
----------------
Mysql.exe results :
Variable_name               Value
character_set_client        utf8
character_set_connection    utf8
character_set_database      utf8
character_set_filesystem    binary
character_set_results       utf8
character_set_server        utf8
character_set_system        utf8
character_sets_dir          ...\share\charsets\
collation_connection        utf8_general_ci
collation_database          utf8_general_ci
collation_server            utf8_general_ci


Actual result:
--------------
php_mysql.dll results :
Variable_name               Value
character_set_client        latin1
character_set_connection    latin1
character_set_database      utf8
character_set_filesystem    binary
character_set_results       latin1
character_set_server        utf8
character_set_system        utf8
character_sets_dir          ...\share\charsets\
collation_connection        latin1_swedish_ci
collation_database          utf8_general_ci
collation_server            utf8_general_ci


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-15 16:38 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 07:01:32 2024 UTC