|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57047 stored procedures - corrupt output
Submitted: 2006-05-29 08:39 UTC Modified: 2007-03-22 13:41 UTC
From: kprinz at screamdesign dot de Assigned: kraman (profile)
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.1.2 OS: SLES 9 64 bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kprinz at screamdesign dot de
New email:
PHP Version: OS:


 [2006-05-29 08:39 UTC] kprinz at screamdesign dot de
I?m using ZendCore newest version

'./configure' '--prefix=/usr/local/Zend/Core' '--with-config-file-path=/etc' '--enable-force-cgi-redirect' '--enable-fastcgi' '--disable-debug' '--enable-inline-optimization' '--enable-memory-limit' '--disable-all' '--enable-ctype' '--enable-dom' '--enable-libxml' '--with-libxml-dir=/usr/local/Zend/Core' '--with-openssl=/usr/local/Zend/Core' '--with-pcre-regex' '--enable-session' '--enable-simplexml' '--enable-spl' '--enable-wddx' '--enable-xml' '--with-zlib=/usr/local/Zend/Core' '--with-pear' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-layout=GNU'

the output of stored procedures called on a DB2 on a AS400 is corrupt. The newest version of Zend Core is installed. The efforts of the Zend team and IBM engineers in creating a patch or a work around failed.

The call of the stored procedures with perl DBI::DB2 works perfectly fine, so the stored procedures are not the problem.

Reproduce code:
$conn = db2_connect($database, $user, $password);
$saij = 2001;
$sais = "FS";
if ($conn) {
$stmt = db2_prepare($conn, $sql);
db2_bind_param($stmt, 1, "saij", DB2_PARAM_INOUT);
db2_bind_param($stmt, 2, "sais", DB2_PARAM_INOUT);
echo $sais." ".$saij."\n";

Expected result:
2006 FS

Actual result:
2005 H#


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-30 14:37 UTC] kfbombar at us dot ibm dot com
Please use CVS Head and let me know if this fixes your issue.
 [2006-06-20 08:30 UTC] kprinz at screamdesign dot de
kfbombar, what do you mean with using CVS Head?, I have Zend Core for IBM installed and i do want to avoid a version conflict
 [2006-06-20 10:22 UTC] kfbombar at us dot ibm dot com
By CVS HEAD I meant the latest ibm_db2 code from CVS.

I looked into this exact bug a while back and found that when using the correct user the output from the stored procedure was correct.  Although I had to add a small fix for the truncated output.  If at all possible, use the latest ibm_db2 code.  Also please check the user that is calling the stored procedure to make sure you are expected the correct output.  Let us know if you have any other issues.
 [2006-06-20 11:40 UTC] kprinz at screamdesign dot de
Hi kfbombar,

thanx for your extremly fast reply! I?ve updated Zend Core f?r IBM with the setup tool, all the newest versions of the extensions are installed.
The scripts of the stored procedures are run with the correct apache user, and the strange thing is, one of the procedures works correct (the one i?ve cited above) with this new version, the other one gives still unreadable output. Both procedures are written in RPG and they work perfectly fine with the DBD::DB2 module of perl, so i?m sorry to say, but i?m sure, that this is a PHP problem! In a couple of days the server is online and then i can provide you the source code of the procdures and a link for displaying the output. If it is helpful i can provide the source code of the procedures too.

Please find attached the source code of the second procedure:

Best regards Karl Prinz

   $multdiv = 'a';
   $rabatt  = 0.00;

   $database = 'S65BAD1A';
   $user = 'freshpr';
   $password = 'fresh1912';

   $sql = "CALL PMNLIB.PREISHOLEN(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
   $conn = db2_connect($database, $user, $password);
   $stmt = db2_prepare($conn, $sql);

   db2_bind_param($stmt, 1, "leer", DB2_PARAM_INOUT, 1);
   db2_bind_param($stmt, 2, "lafirm", DB2_PARAM_INOUT, 2);
   db2_bind_param($stmt, 3, "saij", DB2_PARAM_INOUT, 4);
   db2_bind_param($stmt, 4, "sais", DB2_PARAM_INOUT, 2);
   db2_bind_param($stmt, 5, "lasain", DB2_PARAM_INOUT, 3);
   db2_bind_param($stmt, 6, "lamodn", DB2_PARAM_INOUT, 7);
   db2_bind_param($stmt, 7, "customer_id", DB2_PARAM_INOUT, 7);
   db2_bind_param($stmt, 8, "ek", DB2_PARAM_INOUT, 7);
   db2_bind_param($stmt, 9, "ekwaeh", DB2_PARAM_INOUT, 3);
   db2_bind_param($stmt,10, "vk", DB2_PARAM_INOUT, 7);
   db2_bind_param($stmt,11, "vkwaeh", DB2_PARAM_INOUT, 3);
   db2_bind_param($stmt,12, "kurs", DB2_PARAM_INOUT, 10);
   db2_bind_param($stmt,13, "multdiv", DB2_PARAM_INOUT,1);
   db2_bind_param($stmt,14, "rabatt", DB2_PARAM_INOUT, 4);

   return $ek."#".$ekwaeh."#".$vk."#".$vkwaeh."#".$rabatt;

echo "<h1>".fetch_price(26,2006,'FS',1,11247,0004711)."</h1>";
 [2006-06-21 07:37 UTC] kprinz at screamdesign dot de
Dear kfbombar,

the Zend support told me that i should inform you, that the small fix is included in the latest version of Zend Core for IBM. If it?s helpful, a could provide you the data of the Zend support ticket..

Best regards

Karl Prinz
 [2006-06-21 10:04 UTC] kfbombar at us dot ibm dot com
Since the fix is already in Zend Core, I would really consider the problem to be with the user that is running the stored procedure.  If you believe this is not the issue, you can send us the info when you get it set up for looking at your problem more personally.
 [2006-07-19 11:39 UTC] kfbombar at us 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.

 [2006-07-19 12:11 UTC] kprinz at screamdesign dot de
Hi kfbombar,

the last notices were sent to your collegue, because you were in holidays. The last one i?ve sent to you as cc. And by the way the problem isn?t solved at all!

Here is an extract of the e-mail communication:

1. calling the stored procedures with different connections:

i?ve tested the stored procedures with the uncatalogued connections, the result was different, but not correct. I?ve changed the lang variable in the PHP script with no effect (setlocale(LC_CTYPE, 'de_DE.UTF-8');).
So if it helps i could send you the source code of the procedure written in RPG.

2. testing the CVS Head:

i?ve forgotten to mention that i?ve tested the CVS HEAD of ibm_db2 and the problems are more or less the same. The formatting of the output is better (now the correct codepage is used), but the return values of the stored procedures are still wrong or empty...

best regards

Karl Prinz
 [2006-08-07 11:16 UTC] kprinz at screamdesign dot de
The PHP version was changed a month ago and the problems are still the same.

And by the way, the procedures are working with perl and a DB2 Connect Personal Edition without problems !!

Regards Karl
 [2006-08-22 15:20 UTC] kraman at gmail dot com

I have just fixed a IN/OUT param related bug in CVS which could be the cause of the data corruption you are facing. Can you please try the latest version of the driver from CVS and let me know if you still face the problem. Thanks
 [2006-08-23 04:08 UTC] kprinz at screamdesign dot de
Dear Kraman,

thanks for the hint, I?m using Zend Core, so i?ll ask the Zend guys for the latest CVS.

As i wrote kfbombar via email we have problems running test stored procedures on the server of our customer, but if the stored procedures still fails after teh latest CVS update i could provide you the source code of the stored procedures (RPG), if you like...

Best regards 
Karl Prinz
 [2006-09-06 04:02 UTC] kprinz at screamdesign dot de
sorry, but i can?t recompile Zend on a production server of our customer...
 [2006-09-06 04:02 UTC] kprinz at screamdesign dot de
sorry, but i can?t recompile Zend on a production server of our customer... so i?m waiting for a regular ZEND update...

Thanx Karl
 [2006-09-12 14:27 UTC] kfbombar at us dot ibm dot com
Changing status to awaiting feedback due to the wait on Zend update for latest status.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 21 12:03:33 2021 UTC