php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68050 Multibytes Chars
Submitted: 2014-09-19 09:25 UTC Modified: 2017-02-24 09:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: thomas dot baumgartl at stahlgruber dot de Assigned: vnkbabu (profile)
Status: Assigned Package: PDO_IBM (PECL)
PHP Version: 5.4.33 OS: SUSE SERVER ENTERPRISE 12.2
Private report: No CVE-ID: None
 [2014-09-19 09:25 UTC] thomas dot baumgartl at stahlgruber dot de
Description:
------------
System Data:
- PHP 5.4.17
- SUSE LINUX SERVER ENTERPRISE 12.2
- PDO_IBM 1.3.3 (./configure -with-pdo-ibm=/opt/ibm/db2/V10.1)
- Client: utf-8 character set
- Server: EBCDIC 127

Issue:
Select statement doesn´t returns correctly special characters (like Umlauts Ü Ä Ö).
For example an CHAR(3) DB2 column with 'STÜ' returns in an utf-8 client PHP System "ST \000" visible is only "ST".
When I write back to Database "ST \000" an PDO Exception appears. Therefore our programs crashes.

The Reason:
I suppose there are only allocoated 3 bytes (+1 for \0) for a CHAR(3) field, but special characters needs more.
This issue is already solved in the new db2_ibm.c driver v1.9.6 by the expansion_factor variable.

Solution:
Take into account the expansion_factor at the pdo_ibm driver.

Temporary fast Solution but not Stable:
Multiply in ibm_statement.c the col_res->data_size with an constant factor 2,
so that in_lenth is double sized (line 901 in ibm_statement.c).
I think ths fast workaround is not stable.
Long-term issues are not tested.

The patch file is attached.



Patches

multibytePatch (last revision 2014-09-26 11:45 UTC by rahulpriyadarshi@php.net)
ibm_statement_MultiByteCharsPatch (last revision 2014-09-19 09:26 UTC by thomas dot baumgartl at stahlgruber dot de)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-26 11:45 UTC] rahulpriyadarshi@php.net
The following patch has been added/updated:

Patch Name: multibytePatch
Revision:   1411731956
URL:        https://bugs.php.net/patch-display.php?bug=68050&patch=multibytePatch&revision=1411731956
 [2014-09-26 11:47 UTC] rahulpriyadarshi@php.net
-Assigned To: +Assigned To: rahulpriyadarshi
 [2014-09-26 11:47 UTC] rahulpriyadarshi@php.net
This is known issue and we already have the fix for it, please find it in attachment
 [2016-02-07 15:47 UTC] rahulpriyadarshi@php.net
-Assigned To: rahulpriyadarshi +Assigned To: vnkbabu
 [2017-02-23 14:08 UTC] thomas dot baumgartl at stahlgruber dot de
hello 

this patch works.
can you provide this patch vor PDO_IBM version 1.3.4.

thank you.
 [2017-02-24 09:22 UTC] vnkbabu@php.net
Will consolidate the fix into 1.3.4 and will provide the fix in next week.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 22:01:28 2024 UTC