php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59113 Cannot compile using '--enable-memcached-igbinary'
Submitted: 2010-03-13 12:55 UTC Modified: 2010-05-05 16:43 UTC
From: benny at benny dot idv dot hk Assigned:
Status: Closed Package: memcached (PECL)
PHP Version: 5.3.1 OS: CentOS 5.4
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: benny at benny dot idv dot hk
New email:
PHP Version: OS:

 

 [2010-03-13 12:55 UTC] benny at benny dot idv dot hk
Description:
------------
Here is my phpize and ./configure
phpize
./configure --prefix=/opt/php \
--with-libdir=lib64 \
--enable-memcached=shared \
--enable-memcached-igbinary \
--with-libmemcached-dir=/opt/libmemcached


When I run 'make', the following error occurs:
/usr/src/redhat/BUILD/memcached-1.0.1/php_memcached.c: In 
function 'php_memc_zval_to_payload':
/usr/src/redhat/BUILD/memcached-1.0.1/php_memcached.c:2002: 
error: too few arguments to function 'php_json_encode'
/usr/src/redhat/BUILD/memcached-1.0.1/php_memcached.c: In 
function 'php_memc_zval_from_payload':
/usr/src/redhat/BUILD/memcached-1.0.1/php_memcached.c:2167: 
error: too few arguments to function 'php_json_decode'
/usr/src/redhat/BUILD/memcached-1.0.1/php_memcached.c: In 
function 'php_memc_do_result_callback':
/usr/src/redhat/BUILD/memcached-1.0.1/php_memcached.c:2328: 
warning: assignment discards qualifiers from pointer target 
type
/usr/src/redhat/BUILD/memcached-1.0.1/php_memcached.c:2331: 
warning: assignment discards qualifiers from pointer target 
type
make: *** [php_memcached.lo] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.34373 (%build)


I found that the 'php_json_encode' requires 3 parameters 
while 'php_json_decode' requires 5 parameters:

/opt/php/include/php/ext/json/php_json.h:PHP_JSON_API void 
php_json_encode(smart_str *buf, zval *val, int options 
TSRMLS_DC);


/opt/php/include/php/ext/json/php_json.h:PHP_JSON_API void 
php_json_decode(zval *return_value, char *str, int str_len, 
zend_bool assoc, long depth TSRMLS_DC);

But in 'php_memcached.c', there are not enough parameter 
passed.
 php_json_encode(&buf, value TSRMLS_CC);
 php_json_decode(value, payload, payload_len, 0 TSRMLS_CC);




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-09 11:00 UTC] andygui at yahoo dot com
I am seeing this very behavior on FreeBSD 8.0 while trying to upgrade from PHP 5.2.x to 5.3.2 using the ports system. I get the compile error with or without igbinary support turn on at ./configure time.
 [2010-04-09 12:26 UTC] andy at siliconlandmark dot com
The JSON encode and decode functions do indeed require more arguments as GCC states. The following patch addresses the issue. The use of 512 as the depth parameter was taken from the PHP JSON manual and may need to be changed to a constant, if available. I hope this helps someone out there in the same situation as I found myself:

--- php_memcached.c.orig        2010-04-09 11:14:04.000000000 -0400
+++ php_memcached.c     2010-04-09 11:46:25.000000000 -0400
@@ -1999,7 +1999,7 @@
 #if HAVE_JSON_API
                                case SERIALIZER_JSON:
                                {
-                                       php_json_encode(&buf, value TSRMLS_CC);
+                                       php_json_encode(&buf, value, 0 TSRMLS_CC);
                                        buf.c[buf.len] = 0;
                                        MEMC_VAL_SET_TYPE(*flags, MEMC_VAL_IS_JSON);
                                        break;
@@ -2164,7 +2164,7 @@
 
                case MEMC_VAL_IS_JSON:
 #if HAVE_JSON_API
-                       php_json_decode(value, payload, payload_len, 0 TSRMLS_CC);
+                       php_json_decode(value, payload, payload_len, 0, 512 TSRMLS_CC);
 #else
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not unserialize value, no json support");
                        return -1;
 [2010-04-11 10:23 UTC] chris dot s at idleserv dot net
Thanks for the patch andy at siliconlandmark dot com.

Also had the same compile problem when igbinary was enabled. Patch fixed this.
 [2010-05-05 16:23 UTC] andy at siliconlandmark dot com
This issue is addressed in pecl-memcached 1.0.2. This ticket should probably be closed.
 [2010-07-21 04:11 UTC] imwxyz at gmail dot com
There is new issue with php 5.2.13,when run 'make', 
error 
occurs:
too many arguments to function to function 'php_json_encode'
too many arguments to function to function 
'php_json_dencode'

in php_json.h, the definition is
PHP_JSON_API void php_json_encode(smart_str *buf, zval *val 
TSRMLS_DC);
PHP_JSON_API void php_json_decode(zval *return_value, char 
*buf, int buf_len, zend_bool assoc TSRMLS_DC);

so need the old php_memcached.c
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC