|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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); PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 04:00:01 2025 UTC |
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;