From: gerald at copix dot org Operating system: Linux PHP version: 5.2.1 PHP Bug Type: PDO related Bug description: PDO & UTF8 string length & truncate issues
Description: ------------ Hello, While configured in UTF8 mode (eg with the connection string allRequiredInfos;charset=UTF8), when we try to get a VARCHAR2 field limited to X chars, PDO is assuming accents (éàè...) are 2 letters length) and then generates a warning if our content is X chars length (with accents) and truncates the end of the field. Warning: PDOStatement::fetchAll() [scriptAdr/function.PDOStatement-fetchAll]: column 0 data was too large for buffer and was truncated to fit it in /scriptPath.class.php on line 73 We tryed to activate mbstring extension, to use func_overload=4 with no success (the database itself is in ISO-8859-1). If we try not to communicate with the database in UTF8, accents are just ignored (é becomes e, ...) even with correct session parameters. Reproduce code: --------------- Considering the table MYTABLE { MYFIELD VARCHAR2(2); } with one record : MyField -------- éa $pdo = new PDO ('pdo_oci:dbname= (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521)) ) (CONNECT_DATA = (SID = mysid) ) );charset=UTF8', 'myLogin', 'myPassword'); $stmt = $pdo->doQuery ('select MYFIELD from MYTABLE'); $stmt->fetchAll (); //warning Expected result: ---------------- (array[0]->MYFIELD === 'éa') === true; Actual result: -------------- (array[0]->MYFIELD === 'é') === true (array[0]->MYFIELD === 'éa') === true -- Edit bug report at http://bugs.php.net/?id=40957&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40957&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40957&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40957&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40957&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40957&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40957&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40957&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40957&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40957&r=support Expected behavior: http://bugs.php.net/fix.php?id=40957&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40957&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40957&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40957&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40957&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40957&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40957&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40957&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40957&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40957&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40957&r=mysqlcfg