Edit report at https://bugs.php.net/bug.php?id=59808&edit=1
ID: 59808
Comment by: alex at discardmail dot com
Reported by: eborned at gmail dot com
Summary: Compilation error: too many arguments to function
'php_json_decode'
Status: Open
Type: Bug
Package: solr
Operating System: Debian
PHP Version: 5.2.17
Block user comment: N
Private report: N
New Comment:
I have searched through the PHP source tree of 5.2 and 5.3 where it can be seen
that the function php_json_decode (in php/ext/json/php_json.h) requires 5
arguments in PHP 5.3 and 4 in PHP 5.2:
PHP 5.2: php_json_decode(zval *return_value, char *buf, int buf_len, zend_bool
assoc TSRMLS_DC);
PHP 5.3: php_json_decode(zval *return_value, char *str, int str_len, zend_bool
assoc, long depth TSRMLS_DC)
Solr-PECL wants to call php_json_decode with 5 parameters (in
solr-1.0.1/solr_functions_helpers.c):
php_json_decode(&json_decode_ret_val, (char *) json_string,
json_string_length, 1, recursion_depth TSRMLS_CC);
So it can not be compiled with PHP 5.2 in that way. Additionally the command
"ZEND_EXTERN_MODULE_GLOBALS(json)" does not work with PHP 5.2.
I've added a patch which uses the 4-argument-function and does not use
"ZEND_EXTERN_MODULE_GLOBALS(json)" at PHP 5.2. I have not tested if
php_json_decode is working after this patch, but at least PECL-solr can be
compiled with PHP 5.2 and the other functions are working.
Because of this bug it can not be installed via PECL/PEAR, but manually:
wget http://pecl.php.net/get/solr-1.0.1.tgz
tar xfz solr-1.0.1.tgz
cd solr-1.0.1
wget -Opeclsolr.patch
'https://bugs.php.net/patch-display.php?bug_id=59808&patch=peclsolr.patch&revision=latest&download=1'
patch solr_functions_helpers.c peclsolr.patch
phpize
./configure
make
make install
And then add the extension to your php.ini and restart Apache:
extension = solr.so
Previous Comments:
------------------------------------------------------------------------
[2011-10-11 15:18:59] php at discardmail dot com
Same error on CentOS 5.3 and PHP 5.2.13:
./configure --enable-solr=yes --enable-solr-debug=no
--with-curl=/usr/include/curl --with-libxml-dir=/usr/include/libxml2
make
solr-1.0.1/solr_functions_helpers.c:23: error: expected â=â, â,â, â;â,
âasmâ or â__attribute__â before âjson_globalsâ
solr-1.0.1/solr_functions_helpers.c: In function âsolr_json_to_php_nativeâ:
solr-1.0.1/solr_functions_helpers.c:1123: error: too many arguments to function
âphp_json_decodeâ
make: *** [solr_functions_helpers.lo] Error 1
------------------------------------------------------------------------
[2011-09-06 13:15:59] badllama77 at gmail dot com
Same issue
ubuntu 9.04/php 5.2.6
ubuntu 10.04/php 5.2.10
/home/emyers/src/solr-1.0.1/solr_functions_helpers.c:23: error: expected =,
,, ;, asm or __attribute__ before json_globals
/home/emyers/src/solr-1.0.1/solr_functions_helpers.c: In function
solr_json_to_php_native:
/home/emyers/src/solr-1.0.1/solr_functions_helpers.c:1123: error: too many
arguments to function php_json_decode
------------------------------------------------------------------------
[2011-09-05 07:51:07] james at siteace dot co dot uk
I can confirm i have the same issue installing or upgrading on
centOS/Plesk and PHP 5.2.10
I have installed the beta version without issue
------------------------------------------------------------------------
[2011-08-31 18:47:25] ken dot williams at meteorgames dot com
Confirmed same issue with php 5.2.11 / Cent5.4
------------------------------------------------------------------------
[2011-08-15 09:57:31] jeff at deepbass dot net
Same issue.
OSX/PHP 5.3.5
But the make stop right after
solr_functions_helpers.c:23: error: expected '=', ',', ';', 'asm' or
'__attribute__' before 'json_globals'
make: *** [solr_functions_helpers.lo] Error 1
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=59808
--
Edit this bug report at https://bugs.php.net/bug.php?id=59808&edit=1