php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57926 String Truncated exception thrown for no apparent reason
Submitted: 2007-11-23 08:56 UTC Modified: 2009-03-06 01:09 UTC
From: kevin dot lentle at swift-computing dot com Assigned:
Status: Closed Package: PDO_INFORMIX (PECL)
PHP Version: 5.2.1 OS:
Private report: No CVE-ID: None
 [2007-11-23 08:56 UTC] kevin dot lentle at swift-computing dot com
Description:
------------
When attempting to access a database we get an exception thrown in informix_statement...

SQLSTATE[22001]: String data, right truncated: -11023 [Informix][Informix ODBC Driver]String data right truncation. (SQLExecute[-11023] at ..\pecl_5_2\pdo_informix\informix_statement.c:725)

This seems to be due to memory problems as shown in the test script below. If the 15th line ($thing = "fails") is commented out the script works. If the line is uncommented it fails with the above exception. Note that testtab contains three fields (field1, field2, field3) defined as char(10).

Client: Windows XP, Informix CSDK 2.90.TC6
Server: SCO OpenServer 5.0.5, Informix SE 7.25.UC6

Reproduce code:
---------------
<?php
try {
	$dsn = "informix:database=/databases1/scv9/scv9;server=scv9;CursorBehavior=1";
	$connArray = array(
		PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
		PDO::ATTR_CASE => PDO::CASE_LOWER,
		PDO::ATTR_PERSISTENT => true
	);
	$dbConn = new PDO($dsn, "swift", "swift99", $connArray);
	
	$query1 = "select * from testtab where field1 = ?";
	$state = $dbConn->prepare($query1);
	$state->execute(array("A"));

	$thing = "fails";
}
catch (PDOException $e) {
	var_dump($e);
}
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-24 09:33 UTC] tom at advancedatatools dot com
I have the same issue using the cvs version of the driver. I also have the string data right truncated occur randomly on a more complex query, one person will enter data and get it, I will try and duplicate and it will go through most of the time. If they submit the same data again (hit refresh) it will often process, or at least after the second or third try.
 [2008-04-21 13:02 UTC] tom at advancedatatools dot com
I just wanted to add, this still intermittently happens with 1.2.0. Most of the time when I can get the error to occur, if I have some extra code [even a print statement will normally do it] between the BindParam and execute() it will run successfully,
 [2008-04-22 00:42 UTC] opendev at us dot ibm dot com
Hi Kevin

Thanks for choosing our driver. We are currently looking into it and would get back to you ASAP.
 [2008-04-29 06:50 UTC] opendev at us dot ibm dot com
Hi Tom/Kevin

I have tried a couple of things using various versions of Informix with PDO_INFORMIX - 1.2.0. The time we do an stmt->execute, the Driver is supposed to pass correct information to the Server. After that is done, the work of driver is over. In my case, it is doing so. However, I would request you to send me some code in which you are facing problems to reproduce and also the version of Informix Server, OS etc. However, by simple C paradigm we understand that between function calls, adding or removing lines of code can not produce an irrational behavior. Similiarly $state->execute is a simple function call which returns boolean True or False. 

If we look at the definition of error code, it occurs when we try to insert 11 chars for example in a datatype that supports only 10 chars like char(10). Thus again I fail to realize when can a code have such a behavior as mentioned in the bug description. It would be nice if I have some code to reproduce to have a better idea.
 [2008-08-01 05:00 UTC] josefbr1 at gmail dot com
hi, i'm working on a project in whitch ihave to make the connexion to an informix database unsing aPHP server (wamp). 
the machine i'm working in can connect using an Informix-CLIfor windows(32 bit) version 2.50.TD2. i have already tryed to load ifx extension. it seems to work but when i check using "extension_loaded('ifx')" commande it returns false and there's noconnexion. 
Please, i'm asking for help.
 [2008-08-04 00:58 UTC] opendev at us dot ibm dot com
Hi,

It seems that the specific extension you are looking for is not installed on the server. You can see the list of all PHP extensions that are available on the server by running "php -m" command from command prompt. If the specific extension is not there then you need to download it from http://pecl4win.php.net/index.php and installation instructions are given in http://in2.php.net/manual/en/install.pecl.windows.php. e.g. if you are looking for PDO_INFORMIX extension, then "php -m" should display this in the list otherwise you need to install it. 

Regards,
Ambrish Bhargava
 [2008-08-05 08:15 UTC] josefbr1 at gmail dot com
hey, to make it fast here's my problem:i
i wanna connect to an informix database server so this is my code : 
<?php
$con=ifx_connect('hgh','hgh','iooi');
.....
?>
and all what i get is this warning :
Warning: ifx_connect() [function.ifx-connect]: E [SQLSTATE=IX 001 SQLCODE=-1829] in C:\wamp\www\ifx\ifx.php on line ..

can some one tell me where is the mistake and how to make it work?
Please Help !! Thx
 [2008-08-06 06:13 UTC] opendev at us dot ibm dot com
Unfortunately this is a problem related to ifx, we don't look after ifx support for PHP. 
We only support pdo_ibm and ibm_db2.

Regards,
Abhigyan Agrawal
 [2008-08-08 10:42 UTC] opendev at us dot ibm dot com
Sorry, I missed pdo_infomix. :)
 [2008-08-20 19:20 UTC] youssef_b_romdhane at hotmail dot com
Hi, i'm trying to connect to an informix database server installed on Red Hat OS using  apach web server (wamp). the client should be installed on a Windows NT or XP machine. We alredy have 'informix-CLI for windows (32 bits)version 2.50.TD2' installed on another machine and it connects without any pb with our informix database server. I installed wamp but it didn't work fine with this version of client, it requires 3 version or up. So i installed 'IBM informix client-SDK 3.50'. this 3.50 client seems great with wamp but it couldn't connect to the server. Any advice please. I really need a solution.
 [2008-08-21 01:52 UTC] opendev at us dot ibm dot com
Hi Kevin,

Are you seeing any error? If yes please let us know about the error that you are facing, while connecting to the Informix sever.

Thanks and Regards

Praveen
 [2008-08-21 02:03 UTC] opendev at us dot ibm dot com
Hi Youssef,

Are you seeing any error? If yes please let us know about the error that you are facing.

[Correction: - the previous post was for Youssef and not Kevin sorry]

Thanks and Regards

Praveen
 [2008-08-22 05:26 UTC] youssef_b_romdhane at hotmail dot com
Hi, first big thx for help
When trying to test my connexion from the ODBC interface (Configuration pannel->administration tools ->Data source (ODBC))  i get this error message :
database sqlcode -931 .....
unspesefied system error =-11356[Informix][Informix ODBC Driver] [informix] Unspecefied system error =-23101
On the bowser (Mozilla firefox ) in get this :
Warning: ........ [SQLSTATE=IX 001 SQLCODE=-1829] in C:\wamp\www\ifx\connexion.php on line xx
thx again for help
 [2008-08-22 08:01 UTC] opendev at us dot ibm dot com
Hi Youssef,

Please check the value of the environment variable INFORMIXDIR, this is to be set to the location where your CSDK is installed (if not you will get the error 23101, which you are facing). Also see to that it is set in the system variables.

Are you using a different code set(like utf-8)? if yes, then please check that the locales (namely DB_LOCALE and CLIENT_LOCALE) are set properly. If this is not set properly then this will also cause the error 23101.


Let us know if this solves your problem.

Thanks and Regards

Praveen
 [2009-03-06 01:09 UTC] abhargav at in dot ibm dot com
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Mar 24 13:01:25 2019 UTC