php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58742 Update dbx to work with PHP 5.3.0
Submitted: 2009-06-30 11:23 UTC Modified: 2011-08-11 10:04 UTC
From: dan at auctionharmony dot com Assigned:
Status: Closed Package: dbx (PECL)
PHP Version: 5.3.0RC4 OS: Linux
Private report: No CVE-ID: None
 [2009-06-30 11:23 UTC] dan at auctionharmony dot com
Description:
------------
dbx fails to build with php 5.3.0

'pecl install dbx' throws many deprecated warnings and fails to build

Reproduce code:
---------------
pecl install dbx

Expected result:
----------------
Expect dbx to build and install.

Actual result:
--------------
Many deprecated warnings, then build error.

 cc -I. -I/tmp/pear/temp/dbx -DPHP_ATOM_INC -I/var/tmp/pear-build-root/dbx-1.1.0/include -I/var/tmp/pear-build-root/dbx-1.1.0/main -I/tmp/pear/temp/dbx -I/usr/lib64/php5/include/php -I/usr/lib64/php5/include/php/main -I/usr/lib64/php5/include/php/TSRM -I/usr/lib64/php5/include/php/Zend -I/usr/lib64/php5/include/php/ext -I/usr/lib64/php5/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/dbx/dbx.c  -fPIC -DPIC -o .libs/dbx.o
/tmp/pear/temp/dbx/dbx.c: In function 'zif_dbx_query':
/tmp/pear/temp/dbx/dbx.c:535: error: 'zval' has no member named 'refcount'
/tmp/pear/temp/dbx/dbx.c:536: error: 'zval' has no member named 'is_ref'
/tmp/pear/temp/dbx/dbx.c: In function 'zif_dbx_fetch_row':
/tmp/pear/temp/dbx/dbx.c:609: error: 'zval' has no member named 'refcount'
/tmp/pear/temp/dbx/dbx.c:610: error: 'zval' has no member named 'is_ref'
make: *** [dbx.lo] Error 1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-09 09:19 UTC] miles at cu-centric dot com
I can confirm this on CentOS 4.8 32 bit.  However, I did not use pecl, but rather downloaded the source and placed it in the 5.3.0/ext directory, buildconf, etc
 [2009-09-09 12:39 UTC] miles at cu-centric dot com
[root@localhost php-src-5.3]# svn info
Path: .
URL: http://svn.php.net/repository/php/php-src/branches/PHP_5_3
Repository UUID: c90b9560-bf6c-de11-be94-00142212c4b1
Revision: 288199
Node Kind: directory
Schedule: normal
Last Changed Author: derick
Last Changed Rev: 288159
Last Changed Date: 2009-09-08 10:03:53 -0400 (Tue, 08 Sep 2009)
Properties Last Updated: 2009-09-09 15:09:43 -0400 (Wed, 09 Sep 2009)

[root@localhost php-src-5.3]#
 [2009-09-22 08:38 UTC] miles at cu-centric dot com
I did the following to get the module to compile:

diff -r 31a92e40f3f5 dbx.c
--- a/dbx.c     Tue Sep 22 08:30:42 2009 -0500
+++ b/dbx.c     Tue Sep 22 08:31:35 2009 -0500
@@ -532,8 +532,8 @@
                                        for (col_index=0; col_index<Z_LVAL_P(rv_column_count); ++col_index) {
                                                zend_hash_index_find(Z_ARRVAL_PP(inforow_ptr), col_index, (void **) &columnname_ptr);
                                                zend_hash_index_find(Z_ARRVAL_PP(row_ptr), col_index, (void **) &actual_ptr);
-                                               (*actual_ptr)->refcount+=1;
-                                               (*actual_ptr)->is_ref=1;
+                                               Z_ADDREF_P(*actual_ptr);
+                                               Z_SET_ISREF_P(*actual_ptr);
                                                zend_hash_update(Z_ARRVAL_PP(row_ptr), Z_STRVAL_PP(columnname_ptr), Z_STRLEN_PP(columnname_ptr) + 1, actual_ptr, sizeof(zval *), NULL);
                                        }
                                }
@@ -606,8 +606,8 @@
                        for (col_index=0; col_index<col_count; ++col_index) {
                                zend_hash_index_find(Z_ARRVAL_PP(inforow_ptr), col_index, (void **) &columnname_ptr);
                                zend_hash_index_find(Z_ARRVAL_P(return_value), col_index, (void **) &actual_ptr);
-                               (*actual_ptr)->refcount+=1;
-                               (*actual_ptr)->is_ref=1;
+                                Z_ADDREF_P(*actual_ptr);
+                                Z_SET_ISREF_P(*actual_ptr);
                                zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_PP(columnname_ptr), Z_STRLEN_PP(columnname_ptr) + 1, actual_ptr, sizeof(zval *), NULL);
                        }
                }
 [2009-09-23 04:06 UTC] mkoppanen@php.net
Hi,

those macros don't exist in PHP 5.2.x. If the extension is supposed to work with PHP 5.2 you need these as well:

#ifndef Z_ADDREF_P
# define Z_ADDREF_P(ptr) (ptr)->refcount++;
# define Z_ADDREF_PP(ptr) Z_ADDREF_P(*(ptr))
#endif

#ifndef Z_SET_ISREF_P
# define Z_SET_ISREF_P(ptr) (ptr)->is_ref = 1;
# define Z_SET_ISREF_PP(ptr) Z_SET_ISREF_P(*(ptr))
#endif
 [2009-09-23 09:35 UTC] mkoppanen@php.net
http://pastebin.com/f21ec639e

Are you OK with this patch?
 [2009-09-23 09:50 UTC] M dot Boeren at guidance dot nl
Patch looks good to me (not actually tested).
Note that this not only addresses the compile failure, but also changes some error messages. This may have unforeseen side-effects.

Ciao and thanks, Marc.
 [2009-09-23 17:32 UTC] mkoppanen@php.net
Committed. I left the error messages as they are. In general error messages should not end with a dot and especially not with three dots.

Let me know if it works.
 [2009-10-20 12:04 UTC] miles at cu-centric dot com
I have been running this for over 30 days without any hiccups.  Is there going to be an official release for this or should I just maintain my own version ?
 [2010-06-24 04:31 UTC] joona dot jarvela at siltavalmennus dot fi
I still got this bug with following configuration 

- PHP 5.3.2 
- FC12 kernel  2.6.32.12-115.fc12.x86_64

Is the patch committed to the pecl repository or should I just compile the module myself?
 [2011-08-08 07:52 UTC] leonard at sirmiles dot nl
Issue still exists on FC15 (php-5.3.6-2.fc15.x86_64). See also bug 17588.
 [2011-08-08 11:41 UTC] leonard at sirmiles dot nl
With the help of some people at #php.pecl I came up with a patch that you can find at http://pastebin.com/wtKJqT1i .

The macros are only defined for use with PHP < 5.3.0. However, for some reason when compiling with 5.3.6 I do get redefinition warnings. Still the build is successful and the module seems functional.
 [2011-08-09 04:50 UTC] M dot Boeren at guidance dot nl
Did you use the package to compile or the svn version? Because 
a patch similar to the one you provided was already committed 
in 2009, there just never was a new package released. The 
committed patch shouldn't have any redefinition warnings.

See http://svn.php.net/viewvc/pecl/dbx/trunk/dbx.c?
r1=257094&r2=288625
 [2011-08-11 10:04 UTC] hirokawa@php.net
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/dbx

please check dbx-1.1.1.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC