|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62625 fetching erroneous data when the data has special characters
Submitted: 2012-07-20 20:13 UTC Modified: 2016-05-12 06:44 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: andresblanco at gmail dot com Assigned: vnkbabu (profile)
Status: Not a bug Package: PDO_INFORMIX (PECL)
PHP Version: 5.3.15 OS: ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
34 + 29 = ?
Subscribe to this entry?

 [2012-07-20 20:13 UTC] andresblanco at gmail dot com
The driver is chopping some values of the return strings. It's like special 
characters counts double. 
If a column 'name' has type varchar(2) and the value of name is 'áa' the value 
returned when queried is 'á' instead of 'áa'. If i resize the column to 
the result is correct.
Below I attach a short script to reproduce the bug. I included the dsn so you can 
see the encoding settings

Test script:
$dsn = "informix:database=base;server=ol_server;host=;client_locale=en_us.utf8;db_locale=en_us.819;service=1526;protocol=olsoctcp;EnableScrollableCursors=1";
$db = new \PDO($dsn, 'user', 'pass');
$db->exec("CREATE TABLE ticket82 ( name VARCHAR(2) );");
$db->exec("INSERT INTO ticket82 VALUES ('aa');");

$statement = $db->query("select name from ticket82;");
$value = $statement->fetchAll(\PDO::FETCH_ASSOC);
echo "expected 'aa' got '{$value[0]['NAME']}'\n";

$db->exec("update ticket82 set name='áa';");
$statement = $db->query("select name from ticket82;");
$value = $statement->fetchAll(\PDO::FETCH_ASSOC);
echo "expected 'áa' got '{$value[0]['NAME']}'\n";

$db->exec("ALTER TABLE ticket82 MODIFY (name varchar(3));");
$statement = $db->query("select name from ticket82;");
$value = $statement->fetchAll(\PDO::FETCH_ASSOC);
echo "expected 'áa' got '{$value[0]['NAME']}'\n";

$db->exec("DROP TABLE ticket82;");

Expected result:
expected 'aa' got 'aa'
expected 'áa' got 'áa'
expected 'áa' got 'áa'

Actual result:
expected 'aa' got 'aa'
expected 'áa' got 'á'
expected 'áa' got 'áa'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-20 20:16 UTC] andresblanco at gmail dot com
The pdo_informix version i'm using is the last one, 1.2.7
 [2014-03-03 18:59 UTC]
-Assigned To: +Assigned To: rahulpriyadarshi
 [2014-03-03 18:59 UTC]
I have committed the changes into SVN branch, could you please give a try to this and let me know how it works for your environment.
 [2016-02-07 15:42 UTC]
-Assigned To: rahulpriyadarshi +Assigned To: vnkbabu
 [2016-05-12 06:44 UTC]
-Status: Assigned +Status: Not a bug
 [2016-05-12 06:44 UTC]
  Have verified the issue. Since Informix database is created by default  in 819/1252 codepage and á occupes 2 bytes, hence  select statement after update is is giving only 1 character. Since the table definition has varchar(2) IDS server is returning only 2 bytes(i.e only 1st char), after ALTER statement, SELECT statement returning 'áa' because now the name is VARCHAR(3) and returning total 3 bytes to client.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 20:01:29 2024 UTC