From: serge dot laot at wanadoo dot fr Operating system: Win XP Pro, Win server 2003 PHP version: 5.2.10 PHP Bug Type: MySQL related Bug description: collation discreapency between mysql.exe client and mysql extensions.
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 -- Edit bug report at http://bugs.php.net/?id=48928&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48928&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48928&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48928&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48928&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48928&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48928&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48928&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48928&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48928&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48928&r=support Expected behavior: http://bugs.php.net/fix.php?id=48928&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48928&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48928&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48928&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48928&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48928&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48928&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48928&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48928&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48928&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48928&r=mysqlcfg