php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58679 does not build with php-5.3.x
Submitted: 2009-05-18 12:26 UTC Modified: 2016-10-14 16:27 UTC
Votes:4
Avg. Score:4.0 ± 1.0
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:0 (0.0%)
From: oeriksson at mandriva dot com Assigned:
Status: Suspended Package: amfext (PECL)
PHP Version: 5.3.0RC2 OS: Mandriva Cooker
Private report: No CVE-ID: None
 [2009-05-18 12:26 UTC] oeriksson at mandriva dot com
Description:
------------
amfext does not build with php-5.3.0RC2

Reproduce code:
---------------
as done usually

Expected result:
----------------
should build

Actual result:
--------------
[...]
ILD/amfext-0.9.2/amf.c  -fPIC -DPIC -o .libs/amf.o
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'amf3_serialize_object_default':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:1039: warning: format '%d' expects type 'int', but argument 3 has type 'ulong'
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'amf3_serialize_object':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:1188: error: 'zval' has no member named 'refcount'
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'zif_amf_join_test':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:2326: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'zif_amf_encode':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:2370: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:2377: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'amf3_read_string':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:2673: error: 'zval' has no member named 'refcount'
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'amf3_unserialize_var':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:3175: warning: format '%X' expects type 'unsigned int', but argument 4 has type 'char *'
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'zif_amf_decode':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:3374: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:3380: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:3388: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'zif_amf_sb_append_move':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:3464: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'zif_amf_sb_append':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:3491: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c: In function 'zif_amf_sb_write':
/home/oden/RPM/BUILD/amfext-0.9.2/amf.c:3538: warning: 'zend_get_parameters_ex' is deprecated (declared at /usr/include/php/Zend/zend_API.h:222)
[...]


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-12 13:22 UTC] adam at criticaldevelopment dot net
Same result here. Using CentOS and PHP 5.3.0 release.
 [2009-12-14 19:02 UTC] FxChiP at Gmail dot com
On line 1188, replace:

int deallocResult = (*struc)->refcount;

with

int deallocResult = Z_REFCOUNT_PP(struc);

On line 2674, replace:

newval->refcount--;

with

Z_DELREF_P(newval);

(yes, I checked, both perform the exact same function)

This will allow amf.c to build, but the warnings about zend_get_parameters_ex will still be present. They can be ignored.
 [2009-12-27 10:00 UTC] oeriksson at mandriva dot com
This fixes the build and an "undefined symbol: ZVAL_ADDREF" error at runtime:

--- amf.c       2009-12-27 15:48:17.777644177 +0100  
+++ amf.c.oden  2009-12-27 15:47:41.271614816 +0100  
@@ -844,7 +844,8 @@ static inline void amf_write_zstring(amf
                                                            
                buf->last_chunk->size = 1;  /*  zval chun */
                buf->last_chunk->zv = zstr;                 
-               ZVAL_ADDREF(zstr);                          
+               Z_ADDREF_P(zstr);                           
+                                                           
                buf->chunks++;                              
                buf->left_in_part -= sizeof(amf_string_chunk);
                                                              
@@ -1185,7 +1186,7 @@ static void amf3_serialize_object(amf_se
                int resultType = AMFC_TYPEDOBJECT;            
                int resultValueLength = 0;                    
                zval** resultValue = struc;                   
-               int deallocResult = (*struc)->refcount;       
+               int deallocResult = Z_REFCOUNT_PP(struc);     
                                                              
                resultType = amf_perform_serialize_callback(struc, &className,&classNameLen,&resultValue,var_hash TSRMLS_CC);

@@ -2670,7 +2671,7 @@ static int amf3_read_string(zval **rval,
                }
                else
                {
-                       newval->refcount--;
+                       Z_DELREF_P(newval);
                }
                *rval = newval;
        }
@@ -2824,7 +2825,7 @@ static int amf_read_objectdata(zval **rv
        {
                if(zClassname != NULL)
                {
-                       ZVAL_ADDREF(zClassname);
+                       Z_ADDREF_P(zClassname);
                        add_assoc_zval(*rval, "_explicitType",zClassname);
                }
        }
@@ -3045,7 +3046,7 @@ static int amf3_unserialize_var(zval **r
                                MAKE_STD_ZVAL(zClassDef);
                                amf_array_init(zClassDef,nClassMemberCount+2 TSRMLS_CC);
                                add_next_index_long(zClassDef,(bTypedObject?1:0)|nClassMemberCount << AMF_CLASS_MEMBERCOUNT_SHIFT |iDynamicObject|iExternalizable);
-                               ZVAL_ADDREF(zClassname);
+                               Z_ADDREF_P(zClassname);
                                add_next_index_zval(zClassDef, zClassname);

                                 /*  loop over classMemberCoun */
@@ -3056,7 +3057,7 @@ static int amf3_unserialize_var(zval **r
                                        {
                                                break;
                                        }
-                                       ZVAL_ADDREF(zMemberName);
+                                       Z_ADDREF_P(zMemberName);
                                        add_next_index_zval(zClassDef,zMemberName);  /*  pass referenc */
                                }

@@ -3201,7 +3202,7 @@ static int amf3_unserialize_var(zval **r
                                {
                                        if(bTypedObject != 0)
                                        {
-                                               ZVAL_ADDREF(zClassname);
+                                               Z_ADDREF_P(zClassname);
                                                add_assoc_zval(*rval, "_explicitType",zClassname);
                                        }
                                }
 [2010-12-26 12:36 UTC] sylvain dot lecoy at gmail dot com
I cannot compile as well:

root@Web:/home/admin# /usr/local/zend/bin/pecl install 
channel://pecl.php.net/a
mfext-0.9.2
downloading amfext-0.9.2.tgz ...
Starting to download amfext-0.9.2.tgz (37,147 bytes)
..........done: 37,147 bytes
8 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
building in /var/tmp/pear-build-root/amfext-0.9.2
running: /tmp/pear/download/amfext-0.9.2/configure
checking for grep that handles long lines and -e... 
/bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/zend
checking for PHP includes... -I/usr/local/zend/include/php -
I/usr/local/zend/inc
lude/php/main -I/usr/local/zend/include/php/TSRM -
I/usr/local/zend/include/php/Z
end -I/usr/local/zend/include/php/ext -
I/usr/local/zend/include/php/ext/date/lib

checking for PHP extension directory... 
//usr/local/zend/lib/php_extensions
checking for PHP installed headers prefix... 
/usr/local/zend/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if 
you want to regenerate
 PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable AMF Serialization support... yes, 
shared
checking for ANSI C header files... yes
/tmp/pear/download/amfext-0.9.2/configure: line 4535: 
PHP_AMF_SETUP_AMF_CHECKER:
 command not found
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 
1572864
checking command to parse /usr/bin/nm -B output from cc 
object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) 
supports shared libra
ries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... 
immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /var/tmp/pear-build-root/amfext-0.9.2/libtool --
mode=compile cc  -I. -
I/tmp/pear/download/amfext-0.9.2 -DPHP_ATOM_INC -
I/var/tmp/pear-build-root/amfex
t-0.9.2/include -I/var/tmp/pear-build-root/amfext-0.9.2/main 
-I/tmp/pear/downloa
d/amfext-0.9.2 -I/usr/local/zend/include/php -
I/usr/local/zend/include/php/main
-I/usr/local/zend/include/php/TSRM -
I/usr/local/zend/include/php/Zend -I/usr/loc
al/zend/include/php/ext -
I/usr/local/zend/include/php/ext/date/lib  -DHAVE_CONFI
G_H  -g -O2   -c /tmp/pear/download/amfext-0.9.2/amf.c -o 
amf.lo
mkdir .libs
 cc -I. -I/tmp/pear/download/amfext-0.9.2 -DPHP_ATOM_INC -
I/var/tmp/pear-build-r
oot/amfext-0.9.2/include -I/var/tmp/pear-build-root/amfext-
0.9.2/main -I/tmp/pea
r/download/amfext-0.9.2 -I/usr/local/zend/include/php -
I/usr/local/zend/include/
php/main -I/usr/local/zend/include/php/TSRM -
I/usr/local/zend/include/php/Zend -
I/usr/local/zend/include/php/ext -
I/usr/local/zend/include/php/ext/date/lib -DHA
VE_CONFIG_H -g -O2 -c /tmp/pear/download/amfext-0.9.2/amf.c  
-fPIC -DPIC -o .lib
s/amf.o
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'amf3_serialize_object_defaul
t':
/tmp/pear/download/amfext-0.9.2/amf.c:1039: warning: format 
'%d' expects type 'i
nt', but argument 3 has type 'ulong'
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'amf3_serialize_object':
/tmp/pear/download/amfext-0.9.2/amf.c:1188: error: 'zval' 
has no member named 'r
efcount'
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'zif_amf_join_test':
/tmp/pear/download/amfext-0.9.2/amf.c:2326: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'zif_amf_encode':
/tmp/pear/download/amfext-0.9.2/amf.c:2370: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
/tmp/pear/download/amfext-0.9.2/amf.c:2377: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'amf3_read_string':
/tmp/pear/download/amfext-0.9.2/amf.c:2673: error: 'zval' 
has no member named 'r
efcount'
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'amf3_unserialize_var':
/tmp/pear/download/amfext-0.9.2/amf.c:3175: warning: format 
'%X' expects type 'u
nsigned int', but argument 4 has type 'char *'
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'zif_amf_decode':
/tmp/pear/download/amfext-0.9.2/amf.c:3374: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
/tmp/pear/download/amfext-0.9.2/amf.c:3380: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
/tmp/pear/download/amfext-0.9.2/amf.c:3388: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'zif_amf_sb_append_move':
/tmp/pear/download/amfext-0.9.2/amf.c:3464: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'zif_amf_sb_append':
/tmp/pear/download/amfext-0.9.2/amf.c:3491: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
/tmp/pear/download/amfext-0.9.2/amf.c: In function 
'zif_amf_sb_write':
/tmp/pear/download/amfext-0.9.2/amf.c:3538: warning: 
'zend_get_parameters_ex' is
 deprecated (declared at 
/usr/local/zend/include/php/Zend/zend_API.h:222)
make: *** [amf.lo] Error 1
ERROR: `make' failed
root@Web:/home/admin#
 [2011-04-03 06:37 UTC] 84086710 at qq dot com
root@liuzhansheng-desktop:/amfext-0.9.2# make
/bin/bash /amfext-0.9.2/libtool --mode=compile cc  -I. -I/amfext-0.9.2 -DPHP_ATO                                                                                                 M_INC -I/amfext-0.9.2/include -I/amfext-0.9.2/main -I/amfext-0.9.2 -I/usr/includ                                                                                                 e/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zen                                                                                                 d -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -                                                                                                 D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c /amfext-0.9.2/amf.c -o amf.l                                                                                                 o
libtool: compile:  cc -I. -I/amfext-0.9.2 -DPHP_ATOM_INC -I/amfext-0.9.2/include                                                                                                  -I/amfext-0.9.2/main -I/amfext-0.9.2 -I/usr/include/php5 -I/usr/include/php5/ma                                                                                                 in -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/                                                                                                 usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_                                                                                                 CONFIG_H -g -O2 -c /amfext-0.9.2/amf.c  -fPIC -DPIC -o .libs/amf.o
/amfext-0.9.2/amf.c: In function ??amf3_serialize_object_default??:
/amfext-0.9.2/amf.c:1039: warning: format ??%d?? expects type ??int??, but argument                                                                                                  3 has type ??ulong??
/amfext-0.9.2/amf.c: In function ??amf3_serialize_object??:
/amfext-0.9.2/amf.c:1188: error: ??zval?? has no member named ??refcount??
/amfext-0.9.2/amf.c: In function ??zif_amf_join_test??:
/amfext-0.9.2/amf.c:2326: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
/amfext-0.9.2/amf.c: In function ??zif_amf_encode??:
/amfext-0.9.2/amf.c:2370: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
/amfext-0.9.2/amf.c:2377: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
/amfext-0.9.2/amf.c: In function ??amf3_read_string??:
/amfext-0.9.2/amf.c:2673: error: ??zval?? has no member named ??refcount??
/amfext-0.9.2/amf.c: In function ??amf3_unserialize_var??:
/amfext-0.9.2/amf.c:3175: warning: format ??%X?? expects type ??unsigned int??, but                                                                                                  argument 4 has type ??char *??
/amfext-0.9.2/amf.c: In function ??zif_amf_decode??:
/amfext-0.9.2/amf.c:3374: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
/amfext-0.9.2/amf.c:3380: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
/amfext-0.9.2/amf.c:3388: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
/amfext-0.9.2/amf.c: In function ??zif_amf_sb_append_move??:
/amfext-0.9.2/amf.c:3464: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
/amfext-0.9.2/amf.c: In function ??zif_amf_sb_append??:
/amfext-0.9.2/amf.c:3491: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
/amfext-0.9.2/amf.c: In function ??zif_amf_sb_write??:
/amfext-0.9.2/amf.c:3538: warning: ??zend_get_parameters_ex?? is deprecated (decla                                                                                                 red at /usr/include/php5/Zend/zend_API.h:222)
make: *** [amf.lo] ???? 1


PHP 5.3.1
 [2011-04-18 08:31 UTC] sylvain dot lecoy at gmail dot com
It still doesn't build with php 5.3. Any plans to make a release which builds with ?
 [2011-06-12 03:34 UTC] php at mailinator dot com
You can add a -w flag to the compiler to ignore the 
deprecation warnings.  It appears to work fine still with PHP 
5.3.X.
 [2011-12-28 20:37 UTC] prdgreene at gmail dot com
Ok. I had ongoing issues with this, where even though I did this amf.c 
alteration, I still had issues when loading some flash related pages and PHP-
FPM. fpm error:
WARNING: pid , fpm_children_bury(), line 252: [pool www] child exited with code 
127 after 83.706070 seconds from start.
In php-fpm.conf I enabled: catch_workers_output = yes
then found this AMF error in the php-fpm error log: amf.so: undefined symbol: 
ZVAL_ADDREF


How I was able to fix, was to add this as well in amf.c:

Z_ADDREF_P(zstr);
instead of
ZVAL_ADDREF(zstr);

Z_ADDREF_P(zClassname);
instead of
ZVAL_ADDREF(zClassname);

Z_ADDREF_P(zClassname);
instead of
ZVAL_ADDREF(zClassname);

Z_ADDREF_P(zMemberName);
instead of
ZVAL_ADDREF(zMemberName);

Z_ADDREF_P(zClassname);
instead of
ZVAL_ADDREF(zClassname);

Side note: I replaced my comments /*...*/ with // as well just in case.
 [2015-06-05 17:10 UTC] cmb@php.net
It seems the PECL package isn't maintained anymore. FWIW there is
a fork on Github[1] which claims to be compatible with recent PHP
versions.

Related to bug #59268 which might be a duplicate.

[1] <https://github.com/protetore/amfext>
 [2016-10-14 16:27 UTC] cmb@php.net
-Status: Open +Status: Suspended
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC