php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58273 ibm_db2 1.6.6 fails to compile (still a problem w/ 1.8.2)
Submitted: 2008-07-14 15:55 UTC Modified: 2009-12-24 03:20 UTC
From: randy at greatplainsmfg dot com Assigned:
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.2.6 OS: Solaris
Private report: No CVE-ID: None
 [2008-07-14 15:55 UTC] randy at greatplainsmfg dot com
Description:
------------
The php version is actually 5.2.6 however that version
is not a selection on the "PHP version". I don't think
that actually has any bearing on this issue.
ibm_db2 version 1.6.5 phpize's, configure's, and make's cleanly

Environment:
Solaris 10 (sparc)
Sun Studio 11
php 5.2.6

ibm_db2 version 1.6.6 phpize's and configure's cleanly.
It fails during the make. Following is the output of running
make:

spock% make
/bin/bash /files/source/apache/apache2.2/ibm_db2-1.6.6/libtool --mode=compile cc  -I. -I/files/source/apache/apache2.2/ibm_db2-1.6.6 -DPHP_ATOM_INC -I/files/source/apache/apache2.2/ibm_db2-1.6.6/include -I/files/source/apache/apache2.2/ibm_db2-1.6.6/main -I/files/source/apache/apache2.2/ibm_db2-1.6.6 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/opt/IBM/db2/V9.1/include  -DHAVE_CONFIG_H  -g   -c /files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c -o ibm_db2.lo
mkdir .libs
 cc -I. -I/files/source/apache/apache2.2/ibm_db2-1.6.6 -DPHP_ATOM_INC -I/files/source/apache/apache2.2/ibm_db2-1.6.6/include -I/files/source/apache/apache2.2/ibm_db2-1.6.6/main -I/files/source/apache/apache2.2/ibm_db2-1.6.6 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/opt/IBM/db2/V9.1/include -DHAVE_CONFIG_H -g -c /files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c  -KPIC -DPIC -o .libs/ibm_db2.o
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 1704: warning: function expects to return value: _php_db2_pconnect
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 1751: void function cannot return value
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 1952: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 2676: warning: argument #2 is incompatible with prototype:
        prototype: pointer to unsigned char : "/opt/IBM/db2/V9.1/include/sqlcli.h", line 657
        argument : pointer to char
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4857: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4869: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4882: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4895: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4908: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4922: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4935: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4964: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 4994: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5033: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5061: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5077: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5089: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5105: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5117: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5130: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5144: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5158: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5171: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5183: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5195: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5207: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5258: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5270: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5282: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5294: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5307: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5321: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5347: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5361: warning: statement not reached
"/files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c", line 5534: warning: assignment type mismatch:
        pointer to char "=" pointer to unsigned char
cc: acomp failed for /files/source/apache/apache2.2/ibm_db2-1.6.6/ibm_db2.c
*** Error code 1
make: Fatal error: Command failed for target `ibm_db2.lo'
spock%


It appears that the problem is line 1751 in ibm_db2.c
where a void function PHP_FUNCTION(db2_pconnect) is attempting to return a value.
Comparing this to the same function in version 1.6.5 we
can see that version 1.6.5 is a lot different.

Expected result:
----------------
Expected result is that make runs successfully like it
does with ibm_db2 version 1.6.5 and previous versions.

Actual result:
--------------
See the output in the description section.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-20 23:36 UTC] opendev at us dot ibm dot com
Hi Randy

Thanks for reporting this Bug. I am currently looking into it and would get back to you in a day.

Thanks
 [2008-08-04 06:02 UTC] opendev at us dot ibm dot com
Hi Randy

I am currently unable to repro the error. In the same environment settings, I am able to build my driver successfully. 

Thanks and Regards
Tarun
 [2008-08-13 10:44 UTC] randy at greatplainsmfg dot com
Hi Tarun: I have the same problem with ibm_db2 1.7.0. The problem code is this:
PHP_FUNCTION(db2_pconnect)
{
        return _php_db2_pconnect(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

Which starts on line 1749 in 1.6.6 and line 1834 in 1.7.0.
You have a function defined as void and you are returning
a value. This is a problem.

Take a look at the same function in 1.6.5 and you will notice that unless PASE is defined there is no return
value.

Thanks Randy
 [2008-08-14 11:05 UTC] opendev at us dot ibm dot com
Hi Randy

I am sending across a patch file. Since I am unable to repro the error on my machine, I would need your help to let me know if the changes I am making works for you. Please apply the patch on ibm_db2.c and let me know if the code compiles for you. The version if ibm_db2 used for patch is 1.7.0.

As far as code is concerned, the code is same for 1.6.5 and 1.7.0 except the fact that the IFDEF PASE part was a duplicate code in 1.6.5 and we removed it. Anyways, allow me to try out few things to be able to get to the root of the problem and I would need your help in that.

Thanks and Regards
Tarun Pasrija
 [2008-08-14 17:23 UTC] randy at greatplainsmfg dot com
Hi Tarun: The patch you sent works. The patch changed the problem function from this:
PHP_FUNCTION(db2_pconnect)
{
        return _php_db2_pconnect(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

To this:
PHP_FUNCTION(db2_pconnect)
{
        _php_db2_pconnect(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}

I am changing the status of this bug to "Closed".

Thanks for the prompt help.
Randy
 [2009-04-24 13:46 UTC] randy at greatplainsmfg dot com
I am reopening this bug.

Evidently the patch I was sent for 1.7.0 never made it into production because the same issue (with functions defined as void returning a value) still exists in 1.8.2. The problem code is this:

PHP_FUNCTION(db2_close)
{
        return _php_db2_close_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}

Which starts on line 2560 in 1.8.2.
You have a function defined as void and you are returning
a value. This is a definite problem.
 [2009-04-24 13:56 UTC] randy at greatplainsmfg dot com
The code also has issues with the _php_db2_close_helper() function which starts in line 2497 in ibm_db2.c v1.8.2.

This function is prototyped as:
static int _php_db2_close_helper( INTERNAL_FUNCTION_PARAMETERS, int endpconnect )

Yet there are several lines of code in this function that return void. See lines 2506, 2512, 2524, 2530, 2536, 2545, 2548, 2550, and 2553.
 [2009-05-06 06:30 UTC] abhargav at in dot ibm dot com
Hi,

Thanks for reporting this. Please try following patch:

2497c2497
< static int _php_db2_close_helper( INTERNAL_FUNCTION_PARAMETERS, int endpconnect )
---
> static void _php_db2_close_helper( INTERNAL_FUNCTION_PARAMETERS, int endpconnect )
2562c2562
< 	return _php_db2_close_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
---
> 	_php_db2_close_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
2571c2571
< 	return _php_db2_close_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
---
> 	_php_db2_close_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);

Regards,
Ambrish Bhargava
 [2009-12-24 03:20 UTC] abhargav at in dot ibm dot com
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pecl.php.net/get/ibm_db2


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 08:01:28 2024 UTC